org.junit.AssumptionViolatedException Java Examples

The following examples show how to use org.junit.AssumptionViolatedException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RabbitMQSenderBenchmarks.java    From zipkin-reporter-java with Apache License 2.0 6 votes vote down vote up
@Override protected Sender createSender() throws Exception {
  RabbitMQSender result = RabbitMQSender.newBuilder()
      .queue("zipkin-jmh")
      .addresses("localhost:5672").build();

  CheckResult check = result.check();
  if (!check.ok()) {
    throw new AssumptionViolatedException(check.error().getMessage(), check.error());
  }

  channel = result.localChannel();
  channel.queueDelete(result.queue);
  channel.queueDeclare(result.queue, false, true, true, null);

  Thread.sleep(500L);

  new Thread(() -> {
    try {
      channel.basicConsume(result.queue, true, new DefaultConsumer(channel));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }).start();

  return result;
}
 
Example #2
Source File: NettyEpollITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
	try {
		Configuration config = new Configuration();
		config.setString(NettyShuffleEnvironmentOptions.TRANSPORT_TYPE, "epoll");
		MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(NUM_TASK_MANAGERS)
				.setNumberSlotsPerTaskManager(1)
				.build());
		cluster.before();
		return cluster;
	}
	catch (UnsatisfiedLinkError ex) {
		// If we failed to init netty because we are not on Linux platform, abort the test.
		if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
			throw new AssumptionViolatedException("This test is only supported on linux");
		}
		throw ex;
	}
}
 
Example #3
Source File: ProfileValueChecker.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Determine if the test specified by arguments to the
 * {@linkplain #ProfileValueChecker constructor} is <em>enabled</em> in
 * the current environment, as configured via the {@link IfProfileValue
 * &#064;IfProfileValue} annotation.
 * <p>If the test is not annotated with {@code @IfProfileValue} it is
 * considered enabled.
 * <p>If a test is not enabled, this method will abort further evaluation
 * of the execution chain with a failed assumption; otherwise, this method
 * will simply evaluate the next {@link Statement} in the execution chain.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
 * @throws AssumptionViolatedException if the test is disabled
 * @throws Throwable if evaluation of the next statement fails
 */
@Override
public void evaluate() throws Throwable {
	if (this.testMethod == null) {
		if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testClass)) {
			Annotation ann = AnnotatedElementUtils.findMergedAnnotation(this.testClass, IfProfileValue.class);
			throw new AssumptionViolatedException(String.format(
					"Profile configured via [%s] is not enabled in this environment for test class [%s].",
					ann, this.testClass.getName()));
		}
	}
	else {
		if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testMethod, this.testClass)) {
			throw new AssumptionViolatedException(String.format(
					"Profile configured via @IfProfileValue is not enabled in this environment for test method [%s].",
					this.testMethod));
		}
	}

	this.next.evaluate();
}
 
Example #4
Source File: ContinuousFileProcessingCheckpointITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void createHDFS() throws IOException {
	if (failoverStrategy.equals(FailoverStrategy.RestartPipelinedRegionFailoverStrategy)) {
		// TODO the 'NO_OF_RETRIES' is useless for current RestartPipelinedRegionStrategy,
		// for this ContinuousFileProcessingCheckpointITCase, using RestartPipelinedRegionStrategy would result in endless running.
		throw new AssumptionViolatedException("ignored ContinuousFileProcessingCheckpointITCase when using RestartPipelinedRegionStrategy");
	}

	baseDir = new File("./target/localfs/fs_tests").getAbsoluteFile();
	FileUtil.fullyDelete(baseDir);

	org.apache.hadoop.conf.Configuration hdConf = new org.apache.hadoop.conf.Configuration();

	localFsURI = "file:///" + baseDir + "/";
	localFs = new org.apache.hadoop.fs.Path(localFsURI).getFileSystem(hdConf);
}
 
Example #5
Source File: NettyEpollITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
	try {
		Configuration config = new Configuration();
		config.setString(TRANSPORT_TYPE, "epoll");
		MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(NUM_TASK_MANAGERS)
				.setNumberSlotsPerTaskManager(1)
				.build());
		cluster.before();
		return cluster;
	}
	catch (UnsatisfiedLinkError ex) {
		// If we failed to init netty because we are not on Linux platform, abort the test.
		if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
			throw new AssumptionViolatedException("This test is only supported on linux");
		}
		throw ex;
	}
}
 
Example #6
Source File: NettyEpollITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
private MiniClusterWithClientResource trySetUpCluster() throws Exception {
	try {
		Configuration config = new Configuration();
		config.setString(NettyShuffleEnvironmentOptions.TRANSPORT_TYPE, "epoll");
		MiniClusterWithClientResource cluster = new MiniClusterWithClientResource(
			new MiniClusterResourceConfiguration.Builder()
				.setConfiguration(config)
				.setNumberTaskManagers(NUM_TASK_MANAGERS)
				.setNumberSlotsPerTaskManager(1)
				.build());
		cluster.before();
		return cluster;
	}
	catch (UnsatisfiedLinkError ex) {
		// If we failed to init netty because we are not on Linux platform, abort the test.
		if (findThrowableWithMessage(ex, "Only supported on Linux").isPresent()) {
			throw new AssumptionViolatedException("This test is only supported on linux");
		}
		throw ex;
	}
}
 
Example #7
Source File: ProfileValueChecker.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Determine if the test specified by arguments to the
 * {@linkplain #ProfileValueChecker constructor} is <em>enabled</em> in
 * the current environment, as configured via the {@link IfProfileValue
 * &#064;IfProfileValue} annotation.
 * <p>If the test is not annotated with {@code @IfProfileValue} it is
 * considered enabled.
 * <p>If a test is not enabled, this method will abort further evaluation
 * of the execution chain with a failed assumption; otherwise, this method
 * will simply evaluate the next {@link Statement} in the execution chain.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
 * @throws AssumptionViolatedException if the test is disabled
 * @throws Throwable if evaluation of the next statement fails
 */
@Override
public void evaluate() throws Throwable {
	if (this.testMethod == null) {
		if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testClass)) {
			Annotation ann = AnnotatedElementUtils.findMergedAnnotation(this.testClass, IfProfileValue.class);
			throw new AssumptionViolatedException(String.format(
					"Profile configured via [%s] is not enabled in this environment for test class [%s].",
					ann, this.testClass.getName()));
		}
	}
	else {
		if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testMethod, this.testClass)) {
			throw new AssumptionViolatedException(String.format(
					"Profile configured via @IfProfileValue is not enabled in this environment for test method [%s].",
					this.testMethod));
		}
	}

	this.next.evaluate();
}
 
Example #8
Source File: TargetPlatformRule.java    From Selenium-Foundation with Apache License 2.0 6 votes vote down vote up
@Override
public Statement apply(final Statement base, final Description description) {
    if (!description.isTest()) return base;

    final String contextPlatform = SeleniumConfig.getConfig().getContextPlatform();
    final TargetPlatform targetPlatform = description.getAnnotation(TargetPlatform.class);
    
    platform = TargetPlatformHandler.resolveTargetPlatform(testObject, targetPlatform);
    
    if (TargetPlatformHandler.shouldRun(contextPlatform, platform)) {
        return base;
    } else {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                String message = String.format("%s.%s() doesn't specify platform '%s'",
                        description.getClassName(), description.getMethodName(), contextPlatform);
                throw new AssumptionViolatedException(message);
            }
        };
    }
}
 
Example #9
Source File: PgRule.java    From vertx-sql-client with Apache License 2.0 6 votes vote down vote up
@Override
public Statement apply(Statement base, Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
      try {
        getPostgresVersion();
      }
      catch (Exception e) {
        throw new AssumptionViolatedException(e.getMessage());
      }
      
      before();
      try {
        base.evaluate();
      } finally {
        after();
      }
    }
  };
}
 
Example #10
Source File: TestIOUtils.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public MockLinuxFileSystemProvider(FileSystem delegateInstance, final Map<String,FileStore> filesToStore, Path root) {
  super("mocklinux://", delegateInstance);
  if (mockedPath(root)) {
    throw new AssumptionViolatedException("can't mock /sys and /dev inside of /sys or /dev!");
  }
  final Collection<FileStore> allStores = new HashSet<>(filesToStore.values());
  this.fileSystem = new FilterFileSystem(this, delegateInstance) {
    @Override
    public Iterable<FileStore> getFileStores() {
      return allStores;
    }

    @Override
    public Path getPath(String first, String... more) {
      return new MockLinuxPath(delegateInstance.getPath(first, more), this);
    }
  };
  this.filesToStore = filesToStore;
  this.root = new MockLinuxPath(root, this.fileSystem);
}
 
Example #11
Source File: DataprocAcceptanceTestBase.java    From spark-bigquery-connector with Apache License 2.0 6 votes vote down vote up
protected static AcceptanceTestContext setup(String scalaVersion, String dataprocImageVersion)
    throws Exception {
  // this line will abort the test for the wrong scala version
  String runtimeScalaVersion = Properties.versionNumberString();
  if (!runtimeScalaVersion.startsWith(scalaVersion)) {
    throw new AssumptionViolatedException(
        String.format(
            "Test is for scala %s, Runtime is scala %s", scalaVersion, runtimeScalaVersion));
  }
  String testId =
      String.format(
          "%s-%s%s",
          System.currentTimeMillis(),
          dataprocImageVersion.charAt(0),
          dataprocImageVersion.charAt(2));
  String clusterName = createClusterIfNeeded(dataprocImageVersion, testId);
  AcceptanceTestContext acceptanceTestContext = new AcceptanceTestContext(testId, clusterName);
  uploadConnectorJar(scalaVersion, acceptanceTestContext.connectorJarUri);
  return acceptanceTestContext;
}
 
Example #12
Source File: NaturalLanguageClassifierIT.java    From java-sdk with Apache License 2.0 6 votes vote down vote up
/** Test get classifier. */
@Test
public void bGetClassifier() {
  final Classifier classifier;

  try {
    GetClassifierOptions getOptions =
        new GetClassifierOptions.Builder().classifierId(classifierId).build();
    classifier = service.getClassifier(getOptions).execute().getResult();
  } catch (NotFoundException e) {
    // #324: Classifiers may be empty, because of other tests interfering.
    // The build should not fail here, because this is out of our control.
    throw new AssumptionViolatedException(e.getMessage(), e);
  }
  assertNotNull(classifier);
  assertEquals(classifierId, classifier.getClassifierId());
  assertEquals(Classifier.Status.TRAINING, classifier.getStatus());
}
 
Example #13
Source File: RabbitMQSenderRule.java    From zipkin-reporter-java with Apache License 2.0 6 votes vote down vote up
RabbitMQSender tryToInitializeSender(RabbitMQSender.Builder senderBuilder) {
  RabbitMQSender result = senderBuilder.build();

  CheckResult check;
  try {
    check = result.check();
  } catch (Throwable e) {
    propagateIfFatal(e);
    throw new AssertionError("sender.check shouldn't propagate errors", e);
  }

  if (!check.ok()) {
    throw new AssumptionViolatedException(
        "Couldn't connect to docker container " + container + ": " +
            check.error().getMessage(), check.error());
  }

  return result;
}
 
Example #14
Source File: RabbitMQSenderRule.java    From zipkin-reporter-java with Apache License 2.0 6 votes vote down vote up
@Override protected void before() {
  if ("true".equals(System.getProperty("docker.skip"))) {
    throw new AssumptionViolatedException("Skipping startup of docker " + IMAGE);
  }

  try {
    LOGGER.info("Starting docker image " + IMAGE);
    container = new RabbitMQContainer(IMAGE);
    container.start();
  } catch (Throwable e) {
    throw new AssumptionViolatedException(
        "Couldn't start docker image " + IMAGE + ": " + e.getMessage(), e);
  }

  declareQueue(QUEUE);
}
 
Example #15
Source File: NaturalLanguageClassifierIT.java    From java-sdk with Apache License 2.0 6 votes vote down vote up
/** Test classify. Use the pre created classifier to avoid waiting for availability */
@Test
public void dClassify() {
  Classification classification = null;

  try {
    ClassifyOptions classifyOptions =
        new ClassifyOptions.Builder()
            .classifierId(preCreatedClassifierId)
            .text("is it hot outside?")
            .build();
    classification = service.classify(classifyOptions).execute().getResult();
  } catch (NotFoundException e) {
    // #324: Classifiers may be empty, because of other tests interfering.
    // The build should not fail here, because this is out of our control.
    throw new AssumptionViolatedException(e.getMessage(), e);
  }

  assertNotNull(classification);
  assertEquals("temperature", classification.getTopClass());
}
 
Example #16
Source File: NaturalLanguageClassifierIT.java    From java-sdk with Apache License 2.0 6 votes vote down vote up
/** Test classifyCollection. Use the pre created classifier to avoid waiting for availability */
@Test
public void fClassifyCollection() {
  ClassificationCollection classificationCollection = null;
  ClassifyInput input1 = new ClassifyInput.Builder().text("How hot will it be today?").build();
  ClassifyInput input2 = new ClassifyInput.Builder().text("Is it hot outside?").build();

  try {
    ClassifyCollectionOptions classifyOptions =
        new ClassifyCollectionOptions.Builder()
            .classifierId(preCreatedClassifierId)
            .addClassifyInput(input1)
            .addClassifyInput(input2)
            .build();
    classificationCollection = service.classifyCollection(classifyOptions).execute().getResult();
  } catch (NotFoundException e) {
    // #324: Classifiers may be empty, because of other tests interfering.
    // The build should not fail here, because this is out of our control.
    throw new AssumptionViolatedException(e.getMessage(), e);
  }

  assertNotNull(classificationCollection);
  assertEquals("temperature", classificationCollection.getCollection().get(0).getTopClass());
  assertEquals("temperature", classificationCollection.getCollection().get(1).getTopClass());
}
 
Example #17
Source File: AbstractParallelScenarioRunner.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected Statement prepareMethodBlock(final FrameworkMethod method, final RunNotifier notifier) {
	final Statement methodBlock = superMethodBlock(method);
	return new Statement() {
		@Override
		public void evaluate() throws Throwable {
			try {
				methodBlock.evaluate();
				Description description = describeChild(method);
				try {
					notifier.fireTestStarted(description);
					notifier.fireTestAssumptionFailed(new Failure(description, new AssumptionViolatedException("Method " + method.getName() + " did parse any input")));
				} finally {
					notifier.fireTestFinished(description);
				}
			} catch(TestDataCarrier testData) {
				AbstractParallelScenarioRunner.this.testData.put(method, testData.getData());
			}
		}
	};
}
 
Example #18
Source File: NewVersionAvailableEventTest.java    From edx-app-android with Apache License 2.0 6 votes vote down vote up
/**
 * Get the event bus that's being used in the app.
 *
 * @return The event bus.
 * @throws AssumptionViolatedException If the default event bus can't be constructed because of
 * the Android framework not being loaded. This will stop the calling tests from being reported
 * as failures.
 */
@NonNull
private static EventBus getEventBus() {
    try {
        return EventBus.getDefault();
    } catch (RuntimeException e) {
        /* The event bus uses the Looper from the Android framework, so
         * initializing it would throw a runtime exception if the
         * framework is not loaded. Nor can RoboGuice be used to inject
         * a mocked instance to get around this issue, since customizing
         * RoboGuice injections requires a Context.
         *
         * Robolectric can't be used to solve this issue, because it
         * doesn't support parameterized testing. The only solution that
         * could work at the moment would be to make this an
         * instrumented test suite.
         *
         * TODO: Mock the event bus when RoboGuice is replaced with
         * another dependency injection framework, or when there is a
         * Robolectric test runner available that support parameterized
         * tests.
         */
        throw new AssumptionViolatedException(
                "Event bus requires Android framework", e, nullValue());
    }
}
 
Example #19
Source File: AssumeTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void assumeGroupWithMatchingActiveTestGroup() {
	setTestGroups(LONG_RUNNING);
	try {
		Assume.group(LONG_RUNNING);
	}
	catch (AssumptionViolatedException ex) {
		fail("assumption should NOT have failed");
	}
}
 
Example #20
Source File: IPv6HostnamesITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private Configuration getConfiguration() {
	final Inet6Address ipv6address = getLocalIPv6Address();
	if (ipv6address == null) {
		throw new AssumptionViolatedException("--- Cannot find a non-loopback local IPv6 address that Akka/Netty can bind to; skipping IPv6HostnamesITCase");
	}
	final String addressString = ipv6address.getHostAddress();
	log.info("Test will use IPv6 address " + addressString + " for connection tests");

	Configuration config = new Configuration();
	config.setString(JobManagerOptions.ADDRESS, addressString);
	config.setString(TaskManagerOptions.HOST, addressString);
	config.set(TaskManagerOptions.MANAGED_MEMORY_SIZE, MemorySize.parse("16m"));
	return config;
}
 
Example #21
Source File: RequiresSolrServer.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
private void checkServerRunning() {

		try (CloseableHttpClient client = HttpClientBuilder.create().build()) {

			String url = StringUtils.hasText(collection) ? baseUrl + "/" + collection + "/select?q=*:*" : baseUrl + PING_PATH;

			CloseableHttpResponse response = client.execute(new HttpGet(url));
			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);
		}
	}
 
Example #22
Source File: OffHeapAndDiskStorageEngineDependentTest.java    From offheap-store with Apache License 2.0 5 votes vote down vote up
@Override
public <K, V> FileBackedStorageEngine<K, V> createStorageEngine(PageSource source, Portability<? super K> keyPortability, Portability<? super V> valuePortability, boolean thief, boolean victim) {
  if (!thief && !victim) {
    return new FileBackedStorageEngine<>((MappedPageSource) source, 1024, MemoryUnit.BYTES, keyPortability, valuePortability);
  } else {
    throw new AssumptionViolatedException("FileBackedStorageEngine doesn't support stealing");
  }
}
 
Example #23
Source File: EmbeddedMongo.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected void before() {

	try {
		resource.start();
	} catch (RuntimeException e) {
		LOGGER.error("Cannot start MongoDB", e);
		throw new AssumptionViolatedException("Cannot start MongoDB. Skipping", e);
	}
}
 
Example #24
Source File: OffHeapAndDiskStorageEngineDependentTest.java    From offheap-store with Apache License 2.0 5 votes vote down vote up
@Override
public <K, V> Factory<FileBackedStorageEngine<K, V>> createStorageEngineFactory(PageSource source, Portability<? super K> keyPortability, Portability<? super V> valuePortability, boolean thief, boolean victim) {
  if (!thief && !victim) {
    return FileBackedStorageEngine.createFactory((MappedPageSource) source, 1024, MemoryUnit.BYTES, keyPortability, valuePortability);
  } else {
    throw new AssumptionViolatedException("FileBackedStorageEngine doesn't support stealing");
  }
}
 
Example #25
Source File: TestLifecycleAwareExceptionCapturingTest.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
@Order(2)
void should_have_captured_thrownException() {
    Throwable capturedThrowable = startedTestContainer.getCapturedThrowable();
    assertTrue(capturedThrowable instanceof AssumptionViolatedException);
    assertEquals("got: <false>, expected: is <true>", capturedThrowable.getMessage());
}
 
Example #26
Source File: CouchbaseAvailableRule.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected void before() throws Throwable {

	Socket socket = SocketFactory.getDefault().createSocket();
	try {
		socket.connect(new InetSocketAddress(host, port), Math.toIntExact(timeout.toMillis()));
	} catch (IOException e) {
		throw new AssumptionViolatedException(
				String.format("Couchbase not available on on %s:%d. Skipping tests.", host, port), e);
	} finally {
		socket.close();
	}
}
 
Example #27
Source File: RequiresRedisServer.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@Override
protected void before() throws Throwable {

	try (Socket socket = new Socket()) {
		socket.setTcpNoDelay(true);
		socket.setSoLinger(true, 0);
		socket.connect(new InetSocketAddress(host, port), timeout);
	} catch (Exception e) {
		throw new AssumptionViolatedException(String.format("Seems as Redis is not running at %s:%s.", host, port), e);
	}

	if (NO_VERSION.equals(requiredVersion)) {
		return;
	}

	RedisClient redisClient = RedisClient.create(ManagedClientResources.getClientResources(),
			RedisURI.create(host, port));

	try (StatefulRedisConnection<String, String> connection = redisClient.connect()) {

		String infoServer = connection.sync().info("server");
		String redisVersion = LettuceConverters.stringToProps().convert(infoServer).getProperty("redis_version");
		Version runningVersion = Version.parse(redisVersion);

		if (runningVersion.isLessThan(requiredVersion)) {
			throw new AssumptionViolatedException(String
					.format("This test requires Redis version %s but you run version %s", requiredVersion, runningVersion));
		}

	} finally {
		redisClient.shutdown(Duration.ZERO, Duration.ZERO);
	}
}
 
Example #28
Source File: ElasticsearchAvailable.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
private void checkServerRunning() {

		try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
			CloseableHttpResponse response = client.execute(new HttpHead(url));
			if (response != null && response.getStatusLine() != null) {
				Assumptions.assumeThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
			}
		} catch (IOException e) {
			throw new AssumptionViolatedException(String.format("Elasticsearch Server seems to be down. %s", e.getMessage()));
		}
	}
 
Example #29
Source File: NotifyingBlock.java    From spectrum with MIT License 5 votes vote down vote up
/**
 * Add notification of exceptions to a throwing block.
 * @param description which test called the block
 * @param reporting object to inform of failure
 * @param block the block to execute
 * @throws Throwable the error which was reported to the {@link RunNotifier}
 */
static void executeAndReport(final Description description,
    final RunReporting<Description, Failure> reporting,
    final Block block) throws Throwable {
  try {
    block.run();
  } catch (final AssumptionViolatedException assumptionViolation) {
    reporting.fireTestAssumptionFailed(new Failure(description, assumptionViolation));
    throw assumptionViolation;
  } catch (final Throwable throwable) {
    reporting.fireTestFailure(new Failure(description, throwable));
    throw throwable;
  }
}
 
Example #30
Source File: OrcasParameterizedParallel.java    From orcas with Apache License 2.0 5 votes vote down vote up
@Override
protected void runChild( Runner pRunner, RunNotifier pNotifier )
{
  OrcasBlockJUnit4ClassRunnerWithParameters lOrcasBlockJUnit4ClassRunnerWithParameters = (OrcasBlockJUnit4ClassRunnerWithParameters)pRunner;
  String lTestName = lOrcasBlockJUnit4ClassRunnerWithParameters.testName;

  try
  {
    assumeShouldExecuteTestcase( lTestName );
  }
  catch( AssumptionViolatedException e )
  {
    Description lDescribeChildRunner = describeChild( pRunner );
    pNotifier.fireTestAssumptionFailed( new Failure( lDescribeChildRunner, e ) );
    pNotifier.fireTestIgnored( lDescribeChildRunner );

    for( FrameworkMethod lChildFrameworkMethod : lOrcasBlockJUnit4ClassRunnerWithParameters.getChildren() )
    {
      Description lDescribeChildFrameworkMethod = lOrcasBlockJUnit4ClassRunnerWithParameters.describeChild( lChildFrameworkMethod );

      pNotifier.fireTestAssumptionFailed( new Failure( lDescribeChildFrameworkMethod, e ) );
      pNotifier.fireTestIgnored( lDescribeChildFrameworkMethod );
    }

    return;
  }

  super.runChild( pRunner, pNotifier );
}