当前位置: 首页>>代码示例>>Java>>正文


Java AssumptionViolatedException类代码示例

本文整理汇总了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());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:ReproduceInfoPrinter.java

示例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);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:ESTestCase.java

示例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;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:S3ATestUtils.java

示例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;
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:23,代码来源:SatisfyStepInterceptor.java

示例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;
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:17,代码来源:SatisfyStepInterceptor.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:UnsafeDeopt.java

示例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.
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:UnsafeDeopt.java

示例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();
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:27,代码来源:GremlinProcessRunner.java

示例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);
        }
    };
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:29,代码来源:FlowableDmnRule.java

示例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);
        }
    };
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:27,代码来源:FlowableIdmRule.java

示例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);
        }
    };
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:29,代码来源:ActivitiRule.java

示例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;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:S3ATestUtils.java

示例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);
		}
	};
}
 
开发者ID:hifive,项目名称:hifive-pitalium,代码行数:25,代码来源:ParameterizedTestWatcher.java

示例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;
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:19,代码来源:XmlValidateTest.java

示例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);
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:21,代码来源:XmlValidateTest.java


注:本文中的org.junit.internal.AssumptionViolatedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。