use of org.junit.AssumptionViolatedException in project xtext-core by eclipse.
the class AbstractParallelScenarioRunner method process.
@Override
protected void process(String data) throws Exception {
IInjectorProvider delegate = getOrCreateInjectorProvider().getDelegate();
ScenarioProcessor processor = delegate.getInjector().getInstance(getProcessorClass());
String preProcessed = processor.preProcess(data);
if (preProcessed == null) {
throw new AssumptionViolatedException("Input is filtered by the pre processing step: " + data);
}
doProcess(preProcessed, processor);
}
use of org.junit.AssumptionViolatedException in project jacoco by jacoco.
the class Pack200StreamsTest method unpack_should_throw_IOException_when_Pack200_not_available_in_JDK.
@Test
public void unpack_should_throw_IOException_when_Pack200_not_available_in_JDK() {
try {
Class.forName("java.util.jar.Pack200");
throw new AssumptionViolatedException("this test requires JDK without Pack200");
} catch (ClassNotFoundException ignore) {
}
try {
Pack200Streams.unpack(new ByteArrayInputStream(new byte[0]));
fail("expected exception");
} catch (IOException e) {
assertNull(e.getMessage());
assertTrue(e.getCause() instanceof ClassNotFoundException);
}
}
use of org.junit.AssumptionViolatedException in project jacoco by jacoco.
the class Pack200StreamsTest method pack_should_throw_IOException_when_can_not_write_to_OutputStream.
@Test
public void pack_should_throw_IOException_when_can_not_write_to_OutputStream() {
try {
Class.forName("java.util.jar.Pack200");
} catch (ClassNotFoundException e) {
throw new AssumptionViolatedException("this test requires JDK with Pack200");
}
final OutputStream outputStream = new BrokenOutputStream();
try {
Pack200Streams.pack(new byte[0], outputStream);
fail("expected exception");
} catch (IOException e) {
assertTrue(e.getCause() instanceof IOException);
assertEquals("fake broken output stream", e.getCause().getMessage());
}
}
use of org.junit.AssumptionViolatedException in project iaf by ibissource.
the class XsltErrorTestBase method documentIncludedInSourceNotFoundXslt2.
@Test
public void documentIncludedInSourceNotFoundXslt2() throws Exception {
// error not during configure(), but during doPipe()
setStyleSheetName("/Xslt/importDocument/importNotFound2.xsl");
setXslt2(true);
pipe.configure();
pipe.start();
String input = TestFileUtils.getTestFile("/Xslt/importDocument/in.xml");
String errorMessage = null;
try {
doPipe(pipe, input, session);
fail("Expected to run into an exception");
} catch (AssumptionViolatedException e) {
assumeTrue("assumption violated:" + e.getMessage(), false);
} catch (Exception e) {
errorMessage = e.getMessage();
assertThat(errorMessage, containsString(FILE_NOT_FOUND_EXCEPTION));
}
checkTestAppender(0, null);
System.out.println("ErrorMessage: " + errorMessage);
if (testForEmptyOutputStream) {
System.out.println("ErrorStream(=stderr): " + errorOutputStream.toString());
System.out.println("Clearing ErrorStream, as I am currently unable to catch it");
errorOutputStream = new ErrorOutputStream();
}
}
use of org.junit.AssumptionViolatedException in project iaf by ibissource.
the class XsltErrorTestBase method documentIncludedInSourceNotFoundXslt1.
@Test
public void documentIncludedInSourceNotFoundXslt1() throws Exception {
setStyleSheetName("/Xslt/importDocument/importNotFound1.xsl");
setXslt2(false);
setIndent(true);
pipe.configure();
pipe.start();
String input = TestFileUtils.getTestFile("/Xslt/importDocument/in.xml");
String errorMessage = null;
try {
doPipe(pipe, input, session);
} catch (AssumptionViolatedException e) {
assumeTrue("assumption violated:" + e.getMessage(), false);
} catch (Exception e) {
errorMessage = e.getMessage();
// System.out.println("ErrorMessage: "+errorMessage);
assertThat(errorMessage, containsString(FILE_NOT_FOUND_EXCEPTION));
}
assertThat(testAppender.toString(), containsString(FILE_NOT_FOUND_EXCEPTION));
System.out.println("ErrorMessage: " + errorMessage);
if (testForEmptyOutputStream) {
System.out.println("ErrorStream(=stderr): " + errorOutputStream.toString());
System.out.println("Clearing ErrorStream, as I am currently unable to catch it");
errorOutputStream = new ErrorOutputStream();
}
}
Aggregations