本文整理汇总了Java中org.junit.internal.AssumptionViolatedException类的典型用法代码示例。如果您正苦于以下问题:Java AssumptionViolatedException类的具体用法?Java AssumptionViolatedException怎么用?Java AssumptionViolatedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AssumptionViolatedException类属于org.junit.internal包,在下文中一共展示了AssumptionViolatedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFailure
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
@Override
public void testFailure(Failure failure) throws Exception {
// Ignore assumptions.
if (failure.getException() instanceof AssumptionViolatedException) {
return;
}
final StringBuilder b = new StringBuilder("REPRODUCE WITH: gradle ");
String task = System.getProperty("tests.task");
// TODO: enforce (intellij still runs the runner?) or use default "test" but that won't work for integ
b.append(task);
GradleMessageBuilder gradleMessageBuilder = new GradleMessageBuilder(b);
gradleMessageBuilder.appendAllOpts(failure.getDescription());
// Client yaml suite tests are a special case as they allow for additional parameters
if (ESClientYamlSuiteTestCase.class.isAssignableFrom(failure.getDescription().getTestClass())) {
gradleMessageBuilder.appendClientYamlSuiteProperties();
}
System.err.println(b.toString());
}
示例2: afterAlways
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
@Override
protected void afterAlways(List<Throwable> errors) throws Throwable {
if (errors != null && errors.isEmpty() == false) {
boolean allAssumption = true;
for (Throwable error : errors) {
if (false == error instanceof AssumptionViolatedException) {
allAssumption = false;
break;
}
}
if (false == allAssumption) {
ESTestCase.this.afterIfFailed(errors);
}
}
super.afterAlways(errors);
}
示例3: createTestFileSystem
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
IOException {
String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME, "");
boolean liveTest = !StringUtils.isEmpty(fsname);
URI testURI = null;
if (liveTest) {
testURI = URI.create(fsname);
liveTest = testURI.getScheme().equals(Constants.FS_S3A);
}
if (!liveTest) {
// This doesn't work with our JUnit 3 style test cases, so instead we'll
// make this whole class not run by default
throw new AssumptionViolatedException(
"No test filesystem in " + TestS3AFileSystemContract.TEST_FS_S3A_NAME);
}
S3AFileSystem fs1 = new S3AFileSystem();
//enable purging in tests
conf.setBoolean(Constants.PURGE_EXISTING_MULTIPART, true);
conf.setInt(Constants.PURGE_EXISTING_MULTIPART_AGE, 0);
fs1.initialize(testURI, conf);
return fs1;
}
示例4: runTestStep
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
private Object runTestStep(final Object obj, final Method method,
final Object[] args, final MethodProxy proxy)
throws Throwable {
LOGGER.debug("STARTING STEP: {}", method.getName());
Object result = null;
try {
result = executeTestStepMethod(obj, method, args, proxy, result);
LOGGER.debug("STEP DONE: {}", method.getName());
} catch (AssertionError failedAssertion) {
error = failedAssertion;
logStepFailure(method, args, failedAssertion);
return appropriateReturnObject(obj, method);
} catch (AssumptionViolatedException assumptionFailed) {
return appropriateReturnObject(obj, method);
} catch (Throwable testErrorException) {
error = testErrorException;
logStepFailure(method, args, forError(error).convertToAssertion());
return appropriateReturnObject(obj, method);
}
return result;
}
示例5: executeTestStepMethod
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
private Object executeTestStepMethod(Object obj, Method method, Object[]
args, MethodProxy proxy, Object result) throws Throwable {
try {
result = invokeMethod(obj, args, proxy);
notifyStepFinishedFor(method, args);
} catch (PendingStepException pendingStep) {
notifyStepPending(pendingStep.getMessage());
} catch (IgnoredStepException ignoredStep) {
notifyStepIgnored(ignoredStep.getMessage());
} catch (AssumptionViolatedException assumptionViolated) {
notifyAssumptionViolated(assumptionViolated.getMessage());
}
Preconditions.checkArgument(true);
return result;
}
示例6: testUnsafe
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
@Test
public void testUnsafe() {
int m = 42;
long addr1 = createBuffer();
long addr2 = createBuffer();
try {
ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadUnsafe");
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, addr1, m);
if (getCodeCache() == null) {
return;
}
testAgainstExpected(method, expect, receiver, addr2, m);
} catch (AssumptionViolatedException e) {
// Suppress so that subsequent calls to this method within the
// same Junit @Test annotated method can proceed.
} finally {
disposeBuffer(addr1);
disposeBuffer(addr2);
}
}
示例7: testByteBuffer
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
@Test
public void testByteBuffer() {
int m = 42;
try {
ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadByteBuffer");
Object receiver = method.isStatic() ? null : this;
Result expect = executeExpected(method, receiver, ByteBuffer.allocateDirect(32), m);
if (getCodeCache() == null) {
return;
}
ByteBuffer warmupBuffer = ByteBuffer.allocateDirect(32);
for (int i = 0; i < 10000; ++i) {
readWriteReadByteBuffer(warmupBuffer, (i % 50) + 1);
warmupBuffer.putInt(0, 0);
}
testAgainstExpected(method, expect, receiver, ByteBuffer.allocateDirect(32), m);
} catch (AssumptionViolatedException e) {
// Suppress so that subsequent calls to this method within the
// same Junit @Test annotated method can proceed.
}
}
示例8: runChild
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
@Override
public void runChild(final FrameworkMethod method, final RunNotifier notifier) {
final Description description = describeChild(method);
if (this.isIgnored(method)) {
notifier.fireTestIgnored(description);
} else {
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
boolean ignored = false;
try {
this.methodBlock(method).evaluate();
} catch (AssumptionViolatedException ave) {
eachNotifier.addFailedAssumption(ave);
} catch (Throwable e) {
if (validateForGraphComputer(e)) {
eachNotifier.fireTestIgnored();
logger.info(e.getMessage());
ignored = true;
} else
eachNotifier.addFailure(e);
} finally {
if (!ignored)
eachNotifier.fireTestFinished();
}
}
}
示例9: apply
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
/**
* Implementation based on {@link TestWatcher}.
*/
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
List<Throwable> errors = new ArrayList<>();
startingQuietly(description, errors);
try {
base.evaluate();
succeededQuietly(description, errors);
} catch (AssumptionViolatedException e) {
errors.add(e);
skippedQuietly(e, description, errors);
} catch (Throwable t) {
errors.add(t);
failedQuietly(t, description, errors);
} finally {
finishedQuietly(description, errors);
}
MultipleFailureException.assertEmpty(errors);
}
};
}
示例10: apply
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
/**
* Implementation based on {@link TestWatcher}.
*/
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
List<Throwable> errors = new ArrayList<>();
startingQuietly(description, errors);
try {
base.evaluate();
succeededQuietly(description, errors);
} catch (AssumptionViolatedException e) {
errors.add(e);
skippedQuietly(e, description, errors);
} catch (Throwable t) {
errors.add(t);
failedQuietly(t, description, errors);
}
MultipleFailureException.assertEmpty(errors);
}
};
}
示例11: apply
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
/**
* Implementation based on {@link TestWatcher}.
*/
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
List<Throwable> errors = new ArrayList<Throwable>();
startingQuietly(description, errors);
try {
base.evaluate();
succeededQuietly(description, errors);
} catch (AssumptionViolatedException e) {
errors.add(e);
skippedQuietly(e, description, errors);
} catch (Throwable t) {
errors.add(t);
failedQuietly(t, description, errors);
} finally {
finishedQuietly(description, errors);
}
MultipleFailureException.assertEmpty(errors);
}
};
}
示例12: createTestFileSystem
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
IOException {
String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME, "");
boolean liveTest = !StringUtils.isEmpty(fsname);
URI testURI = null;
if (liveTest) {
testURI = URI.create(fsname);
liveTest = testURI.getScheme().equals(Constants.FS_S3A);
}
if (!liveTest) {
// This doesn't work with our JUnit 3 style test cases, so instead we'll
// make this whole class not run by default
throw new AssumptionViolatedException(
"No test filesystem in " + TestS3AFileSystemContract.TEST_FS_S3A_NAME);
}
S3AFileSystem fs1 = new S3AFileSystem();
fs1.initialize(testURI, conf);
return fs1;
}
示例13: apply
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
@Override
public Statement apply(final Statement base, final Description description, final Object[] params) {
return new Statement() {
public void evaluate() throws Throwable {
ArrayList<Throwable> errors = new ArrayList<Throwable>();
ParameterizedTestWatcher.this.startingQuietly(description, errors, params);
try {
base.evaluate();
ParameterizedTestWatcher.this.succeededQuietly(description, errors, params);
} catch (AssumptionViolatedException var7) {
errors.add(var7);
ParameterizedTestWatcher.this.skippedQuietly(var7, description, errors, params);
} catch (Throwable var8) {
errors.add(var8);
ParameterizedTestWatcher.this.failedQuietly(var8, description, errors, params);
} finally {
ParameterizedTestWatcher.this.finishedQuietly(description, errors, params);
}
MultipleFailureException.assertEmpty(errors);
}
};
}
示例14: testXmlSchemaGood
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
/**
* Test xml schema validation
*/
@Test
public void testXmlSchemaGood() throws BuildException {
try {
buildRule.executeTarget("testSchemaGood");
} catch (BuildException e) {
if (e.getMessage().endsWith(
" doesn't recognize feature http://apache.org/xml/features/validation/schema")
|| e.getMessage().endsWith(
" doesn't support feature http://apache.org/xml/features/validation/schema")) {
throw new AssumptionViolatedException("parser doesn't support schema");
} else {
throw e;
}
}
}
示例15: testXmlSchemaBad
import org.junit.internal.AssumptionViolatedException; //导入依赖的package包/类
/**
* Test xml schema validation
*/
@Test
public void testXmlSchemaBad() {
try {
buildRule.executeTarget("testSchemaBad");
fail("Should throw BuildException because 'Bad Schema Validation'");
} catch (BuildException e) {
if (e.getMessage().endsWith(
" doesn't recognize feature http://apache.org/xml/features/validation/schema")
|| e.getMessage().endsWith(
" doesn't support feature http://apache.org/xml/features/validation/schema")) {
throw new AssumptionViolatedException("parser doesn't support schema");
} else {
assertTrue(
e.getMessage().indexOf("not a valid XML document") > -1);
}
}
}