Skip to content

Commit f20ede4

Browse files
vyshakputhusseridavidmoten
authored andcommitted
fix: One testcase method was missing.
1 parent 9753801 commit f20ede4

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

geo/src/test/java/com/github/davidmoten/geo/TestingUtil.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import java.lang.reflect.InvocationTargetException;
66
import java.lang.reflect.Modifier;
77

8+
import static org.junit.jupiter.api.Assertions.assertTrue;
9+
810
/**
911
* Utility methods for unit tests.
1012
*
@@ -20,10 +22,26 @@ public class TestingUtil {
2022
* @param cls
2123
*/
2224
public static <T> void callConstructorAndCheckIsPrivate(Class<T> cls) {
23-
25+
Constructor<T> constructor;
26+
try {
27+
constructor = cls.getDeclaredConstructor();
28+
} catch (NoSuchMethodException e1) {
29+
throw new RuntimeException(e1);
30+
} catch (SecurityException e1) {
31+
throw new RuntimeException(e1);
32+
}
33+
assertTrue(Modifier.isPrivate(constructor.getModifiers()));
34+
constructor.setAccessible(true);
35+
try {
36+
constructor.newInstance();
37+
} catch (InstantiationException e) {
38+
throw new RuntimeException(e);
39+
} catch (IllegalAccessException e) {
40+
throw new RuntimeException(e);
41+
} catch (IllegalArgumentException e) {
42+
throw new RuntimeException(e);
43+
} catch (InvocationTargetException e) {
44+
throw new RuntimeException(e);
45+
}
2446
}
25-
26-
private static void assertTrue(boolean aPrivate) {
27-
}
28-
2947
}

0 commit comments

Comments
 (0)