Revision db183545
Added by Andreas Müller almost 7 years ago
cdmlib-model/src/test/java/eu/etaxonomy/cdm/validation/NameMustFollowCodeTest.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
@Test |
64 | 64 |
public void testValidEmptyNames() { |
65 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations
|
|
65 |
Set<ConstraintViolation<TaxonName>> constraintViolations |
|
66 | 66 |
= validator.validate(cultivarName); |
67 | 67 |
assertTrue("There should be no constraint violations as this name has data set and therefore no unvalid attributes set", constraintViolations.isEmpty()); |
68 | 68 |
|
... | ... | |
82 | 82 |
@Test |
83 | 83 |
public void testMessage() { |
84 | 84 |
nonViralName.setAcronym("acronym"); |
85 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(nonViralName);
|
|
85 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(nonViralName); |
|
86 | 86 |
assertFalse("There should be a constraint violation as a nonViralName must not have an acronym", constraintViolations.isEmpty()); |
87 | 87 |
String message = constraintViolations.iterator().next().getMessage(); |
88 | 88 |
String expected = "Taxon name must only have attributes set that are available according to their code. E.g. 'acronym name' should only be available for viral names."; |
... | ... | |
92 | 92 |
@Test |
93 | 93 |
public void testValidNonViralName() { |
94 | 94 |
nonViralName.setAcronym("acronym"); |
95 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(nonViralName);
|
|
95 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(nonViralName); |
|
96 | 96 |
assertFalse("There should be a constraint violation as a nonViralName must not have an acronym", constraintViolations.isEmpty()); |
97 | 97 |
|
98 | 98 |
nonViralName = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES()); |
... | ... | |
148 | 148 |
@Test |
149 | 149 |
public void testValidViralName() { |
150 | 150 |
viralName.setAcronym("acronym"); |
151 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(viralName);
|
|
151 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(viralName); |
|
152 | 152 |
assertTrue("There should be no constraint violation as a viral name may have acronym set", constraintViolations.isEmpty()); |
153 | 153 |
|
154 | 154 |
//Invalid |
... | ... | |
183 | 183 |
zoologicalName.setOriginalPublicationYear(1987); |
184 | 184 |
zoologicalName.setPublicationYear(2001); |
185 | 185 |
|
186 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(zoologicalName);
|
|
186 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(zoologicalName); |
|
187 | 187 |
assertTrue("There should be no constraint violation as a zoological name may have breed and years set", constraintViolations.isEmpty()); |
188 | 188 |
} |
189 | 189 |
|
... | ... | |
192 | 192 |
bacterialName.setSubGenusAuthorship("Subgenus author"); |
193 | 193 |
bacterialName.setNameApprobation("Name approbation"); |
194 | 194 |
|
195 |
Set<ConstraintViolation<TaxonName<?,?>>> constraintViolations = validator.validate(bacterialName);
|
|
195 |
Set<ConstraintViolation<TaxonName>> constraintViolations = validator.validate(bacterialName); |
|
196 | 196 |
assertTrue("There should be no constraint violation as a bacterial name may have subgenus authorship or name approbation set", constraintViolations.isEmpty()); |
197 | 197 |
} |
198 | 198 |
|
Also available in: Unified diff
ref #6630 and ref #6368 remove generics from TaxonName