本文整理汇总了Java中org.junit.Test.None类的典型用法代码示例。如果您正苦于以下问题:Java None类的具体用法?Java None怎么用?Java None使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
None类属于org.junit.Test包,在下文中一共展示了None类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expectedException
import org.junit.Test.None; //导入依赖的package包/类
@SuppressWarnings("all")
public Class<? extends Throwable> expectedException(Method method) {
Test annotation = method.getAnnotation(Test.class);
if (annotation == null || annotation.expected() == None.class)
return null;
else
return annotation.expected();
}
示例2: getExpectedException
import org.junit.Test.None; //导入依赖的package包/类
private Class<? extends Throwable> getExpectedException(Test annotation) {
if (annotation == null || annotation.expected() == None.class) {
return null;
} else {
return annotation.expected();
}
}
示例3: getExpectedException
import org.junit.Test.None; //导入依赖的package包/类
protected Class<? extends Throwable> getExpectedException() {
Test annotation = fMethod.getAnnotation(Test.class);
if (annotation == null || annotation.expected() == None.class) {
return null;
} else {
return annotation.expected();
}
}
示例4: runTest
import org.junit.Test.None; //导入依赖的package包/类
@Override
protected void runTest() throws Throwable {
try {
long start = System.currentTimeMillis();
method.invoke(testObject, (Object[])null);
if (expectedException != None.class) {
throw new AssertionFailedError(
"No error was generated for a test case which specifies an error.");
}
if (timeout > 0){
long elapsed = System.currentTimeMillis() - start;
if (elapsed > timeout) {
throw new AssertionFailedError("Test took longer than the specified timeout.");
}
}
} catch (InvocationTargetException e) {
Throwable thrown = e.getCause();
if (thrown == null) { // probably should not happen
throw e;
}
if (expectedException == None.class){
// Convert JUnit4 AssertionError failures to JUnit3 style so
// will be treated as failure rather than error.
if (thrown instanceof AssertionError && !(thrown instanceof AssertionFailedError)){
AssertionFailedError afe = new AssertionFailedError(thrown.toString());
// copy the original stack trace
afe.setStackTrace(thrown.getStackTrace());
throw afe;
}
throw thrown;
}
if (!expectedException.isAssignableFrom(thrown.getClass())){
throw new AssertionFailedError("The wrong exception was thrown from the test case");
}
}
}
示例5: testConstructorNameRequires
import org.junit.Test.None; //导入依赖的package包/类
@Test(expected = None.class)
public void testConstructorNameRequires() {
assertNotNull(Argument.create("thisName", Requires.FALSE));
assertNotNull(Argument.create("a", Requires.OPTIONAL));
assertNotNull(Argument.create("JustANormalLongExtendedNoSpacedArgument", Requires.TRUE));
}
示例6: testConstructorNameRequiresDescription
import org.junit.Test.None; //导入依赖的package包/类
@Test(expected = None.class)
public void testConstructorNameRequiresDescription() {
assertNotNull(Argument.create("name", Requires.FALSE, "Desc"));
}
示例7: testConstructorNameRequiresValidValuesDefaultValue
import org.junit.Test.None; //导入依赖的package包/类
@Test(expected = None.class)
public void testConstructorNameRequiresValidValuesDefaultValue() {
assertNotNull(Argument.create("Name", Requires.OPTIONAL, new String[]{"default"}, "default"));
}
示例8: testConstructorNameRequiresDescriptionValidValuesDefaultValue
import org.junit.Test.None; //导入依赖的package包/类
@Test(expected = None.class)
public void testConstructorNameRequiresDescriptionValidValuesDefaultValue() {
assertNotNull(Argument.create("Name", Requires.FALSE, "Desc", new String[]{"Valid", "Values"}, "Values"));
}
示例9: shouldBeStacked
import org.junit.Test.None; //导入依赖的package包/类
@Test(expected = None.class)
public void shouldBeStacked() {
tracer.start();
tracer.get("X-Trace-ID");
tracer.start();
}
示例10: equalsThrowsNoException
import org.junit.Test.None; //导入依赖的package包/类
@Theory
@Test(expected = None.class)
public void equalsThrowsNoException(Object a, Object b) {
assumeNotNull(a);
a.equals(b);
}