Testing - check return value of Set#add instead of separately checking Set#contains

This commit is contained in:
ljacqu
2016-07-03 11:47:37 +02:00
parent 2420a83ec3
commit 8f5817883e
6 changed files with 6 additions and 12 deletions
@@ -74,10 +74,9 @@ public class SettingsClassConsistencyTest {
if (Property.class.isAssignableFrom(field.getType())) {
Property<?> property =
(Property<?>) ReflectionTestUtils.getFieldValue(clazz, null, field.getName());
if (paths.contains(property.getPath())) {
if (!paths.add(property.getPath())) {
fail("Path '" + property.getPath() + "' should be used by only one constant");
}
paths.add(property.getPath());
}
}
}