@NoDriver
@Test(expectedExceptions = {AssertionError.class},
expectedExceptionsMessageRegExp = "JsUtility is a static utility class that cannot be instantiated")
public void testPrivateConstructor() throws Throwable {
Constructor<?>[] ctors;
ctors = JsUtility.class.getDeclaredConstructors();
assertEquals(ctors.length, 1, "JsUtility must have exactly one constructor");
assertEquals(ctors[0].getModifiers() & Modifier.PRIVATE, Modifier.PRIVATE,
"JsUtility constructor must be private");
assertEquals(ctors[0].getParameterTypes().length, 0, "JsUtility constructor must have no arguments");
try {
ctors[0].setAccessible(true);
ctors[0].newInstance();
} catch (InvocationTargetException e) {
throw e.getCause();
}
}
JsUtilityTest.java 文件源码
java
阅读 45
收藏 0
点赞 0
评论 0
项目:Selenium-Foundation
作者:
评论列表
文章目录