微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.junit.internal.AssumptionViolatedException的实例源码

项目:elasticsearch_my    文件ReproduceInfoPrinter.java    @H_404_5@
@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());
}
@H_404_5@ @H_404_5@
项目:elasticsearch_my    文件ESTestCase.java    @H_404_5@
@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);
}
@H_404_5@ @H_404_5@
项目:hadoop    文件S3ATestUtils.java    @H_404_5@
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;
}
@H_404_5@ @H_404_5@
项目:satisfy    文件SatisfyStepInterceptor.java    @H_404_5@
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,FailedAssertion);
        return appropriateReturnObject(obj,method);
    } catch (AssumptionViolatedException assumptionFailed) {
        return appropriateReturnObject(obj,method);
    } catch (Throwable testErrorException) {
        error = testErrorException;
        logStepFailure(method,forError(error).convertToAssertion());
        return appropriateReturnObject(obj,method);
    }

    return result;
}
@H_404_5@ @H_404_5@
项目:satisfy    文件SatisfyStepInterceptor.java    @H_404_5@
private Object executeTestStepMethod(Object obj,Method method,Object[]
        args,MethodProxy proxy,Object result) throws Throwable {
    try {
        result = invokeMethod(obj,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;
}
@H_404_5@ @H_404_5@
项目:openjdk-jdk10    文件UnsafeDeopt.java    @H_404_5@
@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,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);
    }
}
@H_404_5@ @H_404_5@
项目:openjdk-jdk10    文件UnsafeDeopt.java    @H_404_5@
@Test
public void testByteBuffer() {
    int m = 42;
    try {
        ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadByteBuffer");
        Object receiver = method.isstatic() ? null : this;
        Result expect = executeExpected(method,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,m);
    } catch (AssumptionViolatedException e) {
        // Suppress so that subsequent calls to this method within the
        // same Junit @Test annotated method can proceed.
    }
}
@H_404_5@ @H_404_5@
项目:aliyun-oss-hadoop-fs    文件S3ATestUtils.java    @H_404_5@
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
    IOException {
  String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME,conf);
  return fs1;
}
@H_404_5@ @H_404_5@
项目:graal-core    文件UnsafeDeopt.java    @H_404_5@
@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,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);
    }
}
@H_404_5@ @H_404_5@
项目:graal-core    文件UnsafeDeopt.java    @H_404_5@
@Test
public void testByteBuffer() {
    int m = 42;
    try {
        ResolvedJavaMethod method = getResolvedJavaMethod("readWriteReadByteBuffer");
        Object receiver = method.isstatic() ? null : this;
        Result expect = executeExpected(method,m);
    } catch (AssumptionViolatedException e) {
        // Suppress so that subsequent calls to this method within the
        // same Junit @Test annotated method can proceed.
    }
}
@H_404_5@ @H_404_5@
项目:big-c    文件S3ATestUtils.java    @H_404_5@
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
    IOException {
  String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME,conf);
  return fs1;
}
@H_404_5@ @H_404_5@
项目:LiteGraph    文件GremlinProcessRunner.java    @H_404_5@
@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();
        }
    }
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件FlowableDmnRule.java    @H_404_5@
/**
 * 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,errors);
            } finally {
                finishedQuietly(description,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件FlowableIdmRule.java    @H_404_5@
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件ActivitiRule.java    @H_404_5@
/**
 * 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);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件FlowableCmmnRule.java    @H_404_5@
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件FlowableRule.java    @H_404_5@
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件FlowableFormRule.java    @H_404_5@
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:flowable-engine    文件FlowableContentRule.java    @H_404_5@
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:hadoop-2.6.0-cdh5.4.3    文件S3ATestUtils.java    @H_404_5@
public static S3AFileSystem createTestFileSystem(Configuration conf) throws
    IOException {
  String fsname = conf.getTrimmed(TestS3AFileSystemContract.TEST_FS_S3A_NAME,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;
}
@H_404_5@ @H_404_5@
项目:tinkerpop    文件GremlinProcessRunner.java    @H_404_5@
@Override
public void runchild(final FrameworkMethod method,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();
        }
    }
}
@H_404_5@ @H_404_5@
项目:hifive-pitalium    文件ParameterizedTestWatcher.java    @H_404_5@
@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,params);
            } catch (AssumptionViolatedException var7) {
                errors.add(var7);
                ParameterizedTestWatcher.this.skippedQuietly(var7,params);
            } catch (Throwable var8) {
                errors.add(var8);
                ParameterizedTestWatcher.this.FailedQuietly(var8,params);
            } finally {
                ParameterizedTestWatcher.this.finishedQuietly(description,params);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:ant    文件XmlValidateTest.java    @H_404_5@
/**
 * 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;
        }
    }
}
@H_404_5@ @H_404_5@
项目:ant    文件XmlValidateTest.java    @H_404_5@
/**
 * 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);
        }
    }
}
@H_404_5@ @H_404_5@
项目:ant    文件TestProcess.java    @H_404_5@
public void shutdown() {
    if (!done) {
        System.out.println("shutting down TestProcess");
        run = false;

        synchronized (this) {
            while (!done) {
                try {
                    wait();
                } catch (InterruptedException ie) {
                    throw new AssumptionViolatedException("Thread interrupted",ie);
                }
            }
        }

        System.out.println("TestProcess shut down");
    }
}
@H_404_5@ @H_404_5@
项目:ant    文件TestProcess.java    @H_404_5@
public void run() {
    for (int i = 0; i < 5 && run; i++) {
        System.out.println(Thread.currentThread().getName());

        try {
            Thread.sleep(2000);
        } catch (InterruptedException ie) {
            throw new AssumptionViolatedException("Thread interrupted",ie);
        }
    }

    synchronized (this) {
        done = true;
        notifyAll();
    }
}
@H_404_5@ @H_404_5@
项目:JGiven    文件JGivenMethodRule.java    @H_404_5@
@Override
public Statement apply( final Statement base,final FrameworkMethod method,final Object target ) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            starting( base,target );
            try {
                base.evaluate();
                succeeded();
            } catch( AssumptionViolatedException e ) {
                throw e;
            } catch( Throwable t ) {
                Failed( t );
                throw t;
            }
        }
    };
}
@H_404_5@ @H_404_5@
项目:lcm    文件TestWatchman.java    @H_404_5@
public Statement apply(final Statement base,Object target) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            starting(method);
            try {
                base.evaluate();
                succeeded(method);
            } catch (AssumptionViolatedException e) {
                throw e;
            } catch (Throwable t) {
                Failed(t,method);
                throw t;
            } finally {
                finished(method);
            }
        }
    };
}
@H_404_5@ @H_404_5@
项目:lcm    文件TestWatcher.java    @H_404_5@
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:marmotta    文件KiWiDatabaseRunner.java    @H_404_5@
@Override
public Statement apply(final Statement base,Object target) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            logger.info("{} starting...",testName(method));
            try {
                base.evaluate();
                logger.debug("{} SUCCESS",testName(method));
            } catch (AssumptionViolatedException e) {
                logger.info("{} Ignored: {}",testName(method),e.getMessage());
                throw e;
            } catch (Throwable t) {
                logger.warn("{} Failed: {}",t.getMessage());
                throw t;
            }
        }
    };
}
@H_404_5@ @H_404_5@
项目:marmotta    文件LDCacheFileTest.java    @H_404_5@
/**
 * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
 *
 * @return
 */
@Override
protected LDCachingBackend createBackend() {
    final File storageDir = Files.createTempDir();

    LDCachingBackend backend = null;
    try {
        backend = new LDCachingFileBackend(storageDir) {
            @Override
            public void shutdown() {
                super.shutdown();

                try {
                    FileUtils.deleteDirectory(storageDir);
                } catch (IOException e) {
                }
            }
        };
        backend.initialize();

        return backend;
    } catch (RepositoryException e) {
        throw new AssumptionViolatedException("Could not initialise backend",e);
    }
}
@H_404_5@ @H_404_5@
项目:junit    文件TestWatchman.java    @H_404_5@
public Statement apply(final Statement base,method);
                throw t;
            } finally {
                finished(method);
            }
        }
    };
}
@H_404_5@ @H_404_5@
项目:junit    文件TestWatcher.java    @H_404_5@
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:org.openntf.domino    文件TestWatchman.java    @H_404_5@
public Statement apply(final Statement base,method);
                throw t;
            } finally {
                finished(method);
            }
        }
    };
}
@H_404_5@ @H_404_5@
项目:org.openntf.domino    文件TestWatcher.java    @H_404_5@
public Statement apply(final Statement base,errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
@H_404_5@ @H_404_5@
项目:spring-struts-testcase    文件SpringMockStrutsRule.java    @H_404_5@
@Override
protected void succeeded(Description description) {
    try {
        if (!this.actionExecutedAlready) {
            doAction();
        }
        StrutsAction strutsActionAnnotation = getStrutsActionAnnotation(description);
        this.springMockStrutsTestCase.verifyForward(strutsActionAnnotation.expectedForward(),strutsActionAnnotation.expectedForwardpath());
    } catch (Throwable e) {
        Class<? extends Throwable> expected = description.getAnnotation(Test.class).expected();
        if (e.getClass().equals(expected)) {
            throw new AssumptionViolatedException("Expected exception on the struts");
        }
        throw new IllegalStateException(e);
    }
}
@H_404_5@ @H_404_5@
项目:marathonv5    文件AllureMarathonRunListener.java    @H_404_5@
public void fireTestCaseFailure(Throwable throwable) {
    if (throwable instanceof AssumptionViolatedException) {
        getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    } else {
        getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    }
}
@H_404_5@ @H_404_5@
项目:shabdiz    文件ExperimentWatcher.java    @H_404_5@
@Override
protected void skipped(final AssumptionViolatedException e,final Description description) {

    super.skipped(e,description);
    LOGGER.warn("skipped test {} due to assumption violation",description);
    LOGGER.warn("assumption violation",e);
}
@H_404_5@ @H_404_5@
项目:spring-data-examples    文件RequiresRedisSentinel.java    @H_404_5@
private void verify(SentinelsAvailable verificationMode) {

        int Failed = 0;
        for (RedisNode node : sentinelConfig.getSentinels()) {
            if (!isAvailable(node)) {
                Failed++;
            }
        }

        if (Failed > 0) {
            if (SentinelsAvailable.ALL_ACTIVE.equals(verificationMode)) {
                throw new AssumptionViolatedException(String.format(
                        "Expected all Redis Sentinels to respone but %s of %s did not responde",Failed,sentinelConfig
                                .getSentinels().size()));
            }

            if (SentinelsAvailable.ONE_ACTIVE.equals(verificationMode) && sentinelConfig.getSentinels().size() - 1 < Failed) {
                throw new AssumptionViolatedException(
                        "Expected at least one sentinel to respond but it seems all are offline - Game Over!");
            }
        }

        if (SentinelsAvailable.NONE_ACTIVE.equals(verificationMode) && Failed != sentinelConfig.getSentinels().size()) {
            throw new AssumptionViolatedException(String.format(
                    "Expected to have no sentinels online but found that %s are still alive.",(sentinelConfig.getSentinels()
                            .size() - Failed)));
        }
    }
@H_404_5@ @H_404_5@
项目:spring-data-examples    文件RequiresSolrserver.java    @H_404_5@
private void checkServerRunning() {

        try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
            CloseableHttpResponse response = client.execute(new HttpGet(baseUrl + PING_PATH));
            if (response != null && response.getStatusLine() != null) {
                Assume.assumeThat(response.getStatusLine().getStatusCode(),Is.is(200));
            }
        } catch (IOException e) {
            throw new AssumptionViolatedException("Solrserver does not seem to be running",e);
        }
    }
@H_404_5@ @H_404_5@

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。