use of org.graylog2.inputs.extractors.ExtractorException in project graylog2-server by Graylog2.
the class ExtractorTest method testExtractorsWithExceptions.
@Test
public void testExtractorsWithExceptions() throws Exception {
final TestExtractor extractor = new TestExtractor.Builder().callback(new Callable<Result[]>() {
@Override
public Result[] call() throws Exception {
throw new ExtractorException(new IOException("BARF"));
}
}).build();
final Message msg = createMessage("message");
extractor.runExtractor(msg);
assertThat(msg.processingErrors()).hasSize(1);
assertThat(msg.processingErrors().get(0)).satisfies(pe -> {
assertThat(pe.getCause()).isEqualTo(ProcessingFailureCause.ExtractorException);
assertThat(pe.getMessage()).isEqualTo("Could not apply extractor <test-title (test-id)>");
assertThat(pe.getDetails()).isEqualTo("BARF.");
});
}
Aggregations