本文整理汇总了Java中com.carrotsearch.randomizedtesting.RandomizedTest.assumeTrue方法的典型用法代码示例。如果您正苦于以下问题:Java RandomizedTest.assumeTrue方法的具体用法?Java RandomizedTest.assumeTrue怎么用?Java RandomizedTest.assumeTrue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.carrotsearch.randomizedtesting.RandomizedTest
的用法示例。
在下文中一共展示了RandomizedTest.assumeTrue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFailIfUnreferencedFiles
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
@Test
public void testFailIfUnreferencedFiles() {
Result r = JUnitCore.runClasses(Nested1.class);
RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.",
r.getIgnoreCount() == 0);
// We are suppressing output anyway so dump the failures.
for (Failure f : r.getFailures()) {
System.out.println(f.getTrace());
}
Assert.assertEquals("Expected exactly one failure.",
1, r.getFailureCount());
Assert.assertTrue("Expected unreferenced files assertion.",
r.getFailures().get(0).getTrace().contains("unreferenced files:"));
}
示例2: apply
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement s, final Description d) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
if (failuresSoFar >= maxFailures) {
RandomizedTest.assumeTrue("Ignored, failures limit reached (" +
failuresSoFar + " >= " + maxFailures + ").", false);
}
try {
s.evaluate();
} catch (Throwable t) {
if (!TestRuleMarkFailure.isAssumption(t)) {
failuresSoFar++;
}
throw t;
}
}
};
}
示例3: apply
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement s, final Description d) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
int failuresSoFar = FailureMarker.getFailures();
if (failuresSoFar >= maxFailures) {
RandomizedTest.assumeTrue("Ignored, failures limit reached (" +
failuresSoFar + " >= " + maxFailures + ").", false);
}
s.evaluate();
}
};
}
示例4: testFailIfDirectoryNotClosed
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
@Test
public void testFailIfDirectoryNotClosed() {
Result r = JUnitCore.runClasses(Nested1.class);
RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.",
r.getIgnoreCount() == 0);
assertFailureCount(1, r);
Assert.assertTrue(r.getFailures().get(0).toString().contains("Resource in scope SUITE failed to close"));
}
示例5: testWindowsUnremovableFile
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
@Test
public void testWindowsUnremovableFile() throws IOException {
RandomizedTest.assumeTrue("Requires Windows.", Constants.WINDOWS);
RandomizedTest.assumeFalse(LuceneTestCase.LEAVE_TEMPORARY);
Result r = JUnitCore.runClasses(Nested2.class);
Assert.assertEquals(1, r.getFailureCount());
Nested2.openFile.close();
TestUtil.rm(Nested2.parent);
}
示例6: testFailIfDirectoryNotClosed
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
@Test
public void testFailIfDirectoryNotClosed() {
Result r = JUnitCore.runClasses(Nested1.class);
RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.",
r.getIgnoreCount() == 0);
for (Failure f : r.getFailures()) {
System.out.println("Failure: " + f);
}
Assert.assertEquals(1, r.getFailureCount());
Assert.assertTrue(r.getFailures().get(0).toString().contains("Resource in scope SUITE failed to close"));
}
示例7: assumeTrue
import com.carrotsearch.randomizedtesting.RandomizedTest; //导入方法依赖的package包/类
public static void assumeTrue(String msg, boolean condition) {
RandomizedTest.assumeTrue(msg, condition);
}