Revision e6d7b501
Added by Andreas Müller almost 7 years ago
cdmlib-model/src/test/java/eu/etaxonomy/cdm/validation/CorrectEpithetsForRankTest.java | ||
---|---|---|
22 | 22 |
import org.junit.Test; |
23 | 23 |
|
24 | 24 |
import eu.etaxonomy.cdm.model.common.DefaultTermInitializer; |
25 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
|
25 |
import eu.etaxonomy.cdm.model.name.IBotanicalName;
|
|
26 | 26 |
import eu.etaxonomy.cdm.model.name.Rank; |
27 | 27 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
28 | 28 |
import eu.etaxonomy.cdm.validation.constraint.CorrectEpithetsForRankValidator; |
... | ... | |
43 | 43 |
@SuppressWarnings("unused") |
44 | 44 |
private static final Logger logger = Logger.getLogger(CorrectEpithetsForRankTest.class); |
45 | 45 |
|
46 |
private BotanicalName name; |
|
46 |
private IBotanicalName name;
|
|
47 | 47 |
|
48 | 48 |
@Before |
49 | 49 |
public void setUp() { |
... | ... | |
63 | 63 |
public void testValidSpecificName() { |
64 | 64 |
name.setGenusOrUninomial("Aus"); |
65 | 65 |
name.setSpecificEpithet("aus"); |
66 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class, Default.class); |
|
66 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class, Default.class);
|
|
67 | 67 |
assertTrue("There should be no constraint violations as this name has the correct epithets for its rank", constraintViolations.isEmpty()); |
68 | 68 |
} |
69 | 69 |
|
... | ... | |
71 | 71 |
public void testInValidSpecificName() { |
72 | 72 |
name.setGenusOrUninomial("Aus"); |
73 | 73 |
name.setSpecificEpithet(null); // at the default level, this property can be null |
74 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
74 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
75 | 75 |
assertFalse("There should be a constraint violation as this name does not have a specific epithet", constraintViolations.isEmpty()); |
76 | 76 |
assertHasConstraintOnValidator((Set)constraintViolations, CorrectEpithetsForRankValidator.class); |
77 | 77 |
} |
... | ... | |
80 | 80 |
public void testValidFamilyGroupName() { |
81 | 81 |
name.setGenusOrUninomial("Aus"); |
82 | 82 |
name.setRank(Rank.FAMILY()); |
83 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
84 |
assertTrue("There should be no constraint violations as this name has the correct epithets for it rank",constraintViolations.isEmpty()); |
|
83 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
84 |
assertTrue("There should be no constraint violations as this name has the correct epithets for it rank", constraintViolations.isEmpty());
|
|
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
@Test |
... | ... | |
89 | 89 |
name.setGenusOrUninomial("Aus"); |
90 | 90 |
name.setRank(Rank.FAMILY()); // at the default level, this property can be null |
91 | 91 |
name.setSpecificEpithet("aus"); |
92 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
93 |
assertFalse("There should be a constraint violation as this name does not have a specific epithet",constraintViolations.isEmpty()); |
|
92 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
93 |
assertFalse("There should be a constraint violation as this name does not have a specific epithet", constraintViolations.isEmpty());
|
|
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
@Test |
... | ... | |
98 | 98 |
name.setGenusOrUninomial("Aus"); |
99 | 99 |
name.setInfraGenericEpithet("bus"); |
100 | 100 |
name.setRank(Rank.SUBGENUS()); |
101 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
101 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
102 | 102 |
assertTrue("There should be no constraint violations as this name has the correct epithets for it rank",constraintViolations.isEmpty()); |
103 | 103 |
} |
104 | 104 |
|
... | ... | |
107 | 107 |
name.setGenusOrUninomial("Aus"); |
108 | 108 |
name.setRank(Rank.SUBGENUS()); // at the default level, this property can be null |
109 | 109 |
name.setSpecificEpithet("aus"); |
110 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
110 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
111 | 111 |
assertFalse("There should be a constraint violation as this name does not have a specific epithet",constraintViolations.isEmpty()); |
112 | 112 |
} |
113 | 113 |
|
... | ... | |
117 | 117 |
name.setSpecificEpithet("aus"); |
118 | 118 |
name.setInfraSpecificEpithet("ceus"); |
119 | 119 |
name.setRank(Rank.SUBSPECIES()); |
120 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
120 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
121 | 121 |
assertTrue("There should be no constraint violations as this name has the correct epithets for it rank",constraintViolations.isEmpty()); |
122 | 122 |
} |
123 | 123 |
|
... | ... | |
126 | 126 |
name.setGenusOrUninomial("Aus"); |
127 | 127 |
name.setRank(Rank.SUBGENUS()); // at the default level, this property can be null |
128 | 128 |
name.setSpecificEpithet("aus"); |
129 |
Set<ConstraintViolation<BotanicalName>> constraintViolations = validator.validate(name, Level2.class); |
|
129 |
Set<ConstraintViolation<IBotanicalName>> constraintViolations = validator.validate(name, Level2.class);
|
|
130 | 130 |
assertFalse("There should be a constraint violation as this name does not have a specific epithet",constraintViolations.isEmpty()); |
131 | 131 |
} |
132 | 132 |
} |
Also available in: Unified diff
ref #6368 remove TaxonNameBase subclasses