Java 类org.junit.internal.AssumptionViolatedException 实例源码

项目:elasticsearch_my    文件:ReproduceInfoPrinter.java   
@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());
}
项目:elasticsearch_my    文件:ESTestCase.java   
@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);
}
项目:hadoop    文件:S3ATestUtils.java   
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;
}
项目:satisfy    文件:SatisfyStepInterceptor.java   
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;
}
项目:satisfy    文件:SatisfyStepInterceptor.java   
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;
}
项目:openjdk-jdk10    文件:UnsafeDeopt.java   
@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);
    }
}
项目:openjdk-jdk10    文件:UnsafeDeopt.java   
@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.
    }
}
项目:aliyun-oss-hadoop-fs    文件:S3ATestUtils.java   
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;
}
项目:graal-core    文件:UnsafeDeopt.java   
@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);
    }
}
项目:graal-core    文件:UnsafeDeopt.java   
@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.
    }
}
项目:big-c    文件:S3ATestUtils.java   
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;
}
项目:LiteGraph    文件:GremlinProcessRunner.java   
@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();
        }
    }
}
项目:flowable-engine    文件:FlowableDmnRule.java   
/**
 * 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);
        }
    };
}
项目:flowable-engine    文件:FlowableIdmRule.java   
/**
 * 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);
        }
    };
}
项目:flowable-engine    文件:ActivitiRule.java   
/**
 * 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);
        }
    };
}
项目:flowable-engine    文件:FlowableCmmnRule.java   
/**
 * 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);
        }
    };
}
项目:flowable-engine    文件:FlowableRule.java   
/**
 * 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);
        }
    };
}
项目:flowable-engine    文件:FlowableFormRule.java   
/**
 * 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);
        }
    };
}
项目:flowable-engine    文件:FlowableContentRule.java   
/**
 * 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);
        }
    };
}
项目:hadoop-2.6.0-cdh5.4.3    文件:S3ATestUtils.java   
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;
}
项目:tinkerpop    文件:GremlinProcessRunner.java   
@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();
        }
    }
}
项目:hifive-pitalium    文件:ParameterizedTestWatcher.java   
@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);
        }
    };
}
项目:ant    文件:XmlValidateTest.java   
/**
 * 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;
        }
    }
}
项目:ant    文件:XmlValidateTest.java   
/**
 * 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);
        }
    }
}
项目:ant    文件:TestProcess.java   
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");
    }
}
项目:ant    文件:TestProcess.java   
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();
    }
}
项目:JGiven    文件:JGivenMethodRule.java   
@Override
public Statement apply( final Statement base, final FrameworkMethod method, final Object target ) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            starting( base, method, target );
            try {
                base.evaluate();
                succeeded();
            } catch( AssumptionViolatedException e ) {
                throw e;
            } catch( Throwable t ) {
                failed( t );
                throw t;
            }
        }
    };
}
项目:lcm    文件:TestWatchman.java   
public Statement apply(final Statement base, final FrameworkMethod method,
        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);
            }
        }
    };
}
项目:lcm    文件:TestWatcher.java   
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);
        }
    };
}
项目:marmotta    文件:KiWiDatabaseRunner.java   
@Override
public Statement apply(final Statement base, final FrameworkMethod method,
        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: {}", testName(method), t.getMessage());
                throw t;
            }
        }
    };
}
项目:marmotta    文件:LDCacheFileTest.java   
/**
 * 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);
    }
}
项目:junit    文件:TestWatchman.java   
public Statement apply(final Statement base, final FrameworkMethod method,
        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);
            }
        }
    };
}
项目:junit    文件:TestWatcher.java   
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);
        }
    };
}
项目:org.openntf.domino    文件:TestWatchman.java   
public Statement apply(final Statement base, final FrameworkMethod method,
        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);
            }
        }
    };
}
项目:org.openntf.domino    文件:TestWatcher.java   
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);
        }
    };
}
项目:spring-struts-testcase    文件:SpringMockStrutsRule.java   
@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);
    }
}
项目:marathonv5    文件:AllureMarathonRunListener.java   
public void fireTestCaseFailure(Throwable throwable) {
    if (throwable instanceof AssumptionViolatedException) {
        getLifecycle().fire(new TestCaseCanceledEvent().withThrowable(throwable));
    } else {
        getLifecycle().fire(new TestCaseFailureEvent().withThrowable(throwable));
    }
}
项目:shabdiz    文件:ExperimentWatcher.java   
@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);
}
项目:spring-data-examples    文件:RequiresRedisSentinel.java   
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)));
        }
    }
项目:spring-data-examples    文件:RequiresSolrServer.java   
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);
        }
    }