Skip to content

Commit 3772f63

Browse files
committed
Enums: added assertSize() method where missing.
1 parent ff3cce3 commit 3772f63

File tree

8 files changed

+37
-4
lines changed

8 files changed

+37
-4
lines changed

src/main/java/org/nameapi/client/commonwsdl/exception/Blame.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ public static Blame fromValue(String v) {
5353
return valueOf(v);
5454
}
5555

56+
public static void assertSize(int expectedItems) {
57+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
58+
}
5659
}

src/main/java/org/nameapi/client/commonwsdl/exception/Retry.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ public static Retry fromValue(String v) {
3939
return valueOf(v);
4040
}
4141

42+
public static void assertSize(int expectedItems) {
43+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
44+
}
4245
}

src/main/java/org/nameapi/client/services/matcher/personmatcher/AgeMatchType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public enum AgeMatchType {
99
EQUAL,
1010
PARTIAL,
1111
NOT_APPLICABLE,
12-
DIFFERENT;
12+
DIFFERENT,
13+
;
14+
15+
public static void assertSize(int expectedItems) {
16+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
17+
}
1318

1419
}

src/main/java/org/nameapi/client/services/matcher/personmatcher/GenderMatchType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public enum GenderMatchType {
99
POSSIBLY_EQUAL,
1010
POSSIBLY_DIFFERENT,
1111
NOT_APPLICABLE,
12-
DIFFERENT;
12+
DIFFERENT,
13+
;
14+
15+
public static void assertSize(int expectedItems) {
16+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
17+
}
1318

1419
}

src/main/java/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public enum PersonMatchComposition {
99
FULL,
1010
PARTIAL,
1111
INTERSECTION,
12-
NOT_APPLICABLE;
12+
NOT_APPLICABLE,
13+
;
14+
15+
public static void assertSize(int expectedItems) {
16+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
17+
}
1318

1419
}

src/main/java/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public enum PersonMatchType {
99
MATCHING,
1010
SIMILAR,
1111
RELATION,
12-
DIFFERENT;
12+
DIFFERENT,
13+
;
14+
15+
public static void assertSize(int expectedItems) {
16+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
17+
}
1318

1419
}

src/main/java/org/nameapi/client/services/validator/gender/genericgendervalidator/GenderValidationResultType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ public static GenderValidationResultType fromValue(String v) {
2121
return valueOf(v);
2222
}
2323

24+
public static void assertSize(int expectedItems) {
25+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
26+
}
2427
}

src/main/java/org/nameapi/client/services/validator/placeholdernamedetector/FakeType.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ public static FakeType fromValue(String v) {
2121
return valueOf(v);
2222
}
2323

24+
public static void assertSize(int expectedItems) {
25+
assert values().length == expectedItems : "Update the code calling this with " + expectedItems + "!";
26+
}
27+
2428
}

0 commit comments

Comments
 (0)