use of org.elasticsearch.test.junit.listeners.LoggingListener in project elasticsearch by elastic.
the class LoggingListenerTests method testTestRunStartedSupportsClassInDefaultPackage.
public void testTestRunStartedSupportsClassInDefaultPackage() throws Exception {
LoggingListener loggingListener = new LoggingListener();
Description description = Description.createTestDescription(Class.forName("Dummy"), "dummy");
// Will throw an exception without the check for testClassPackage != null in testRunStarted
loggingListener.testRunStarted(description);
}
use of org.elasticsearch.test.junit.listeners.LoggingListener in project elasticsearch by elastic.
the class LoggingListenerTests method testInvalidMethodTestLoggingAnnotation.
public void testInvalidMethodTestLoggingAnnotation() throws Exception {
final LoggingListener loggingListener = new LoggingListener();
final Description suiteDescription = Description.createSuiteDescription(InvalidMethod.class);
loggingListener.testRunStarted(suiteDescription);
final Method method = InvalidMethod.class.getMethod("invalidMethod");
final TestLogging annotation = method.getAnnotation(TestLogging.class);
Description testDescription = Description.createTestDescription(InvalidMethod.class, "invalidMethod", annotation);
final IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> loggingListener.testStarted(testDescription));
assertThat(e.getMessage(), equalTo("invalid test logging annotation [abc:INFO:WARN]"));
}
use of org.elasticsearch.test.junit.listeners.LoggingListener in project crate by crate.
the class LoggingListenerTests method testTestRunStartedSupportsClassInDefaultPackage.
public void testTestRunStartedSupportsClassInDefaultPackage() throws Exception {
LoggingListener loggingListener = new LoggingListener();
Description description = Description.createTestDescription(Class.forName("Dummy"), "dummy");
// Will throw an exception without the check for testClassPackage != null in testRunStarted
loggingListener.testRunStarted(description);
}
use of org.elasticsearch.test.junit.listeners.LoggingListener in project crate by crate.
the class LoggingListenerTests method testInvalidMethodTestLoggingAnnotation.
public void testInvalidMethodTestLoggingAnnotation() throws Exception {
final LoggingListener loggingListener = new LoggingListener();
final Description suiteDescription = Description.createSuiteDescription(InvalidMethod.class);
loggingListener.testRunStarted(suiteDescription);
final Method method = InvalidMethod.class.getMethod("invalidMethod");
final TestLogging annotation = method.getAnnotation(TestLogging.class);
Description testDescription = Description.createTestDescription(InvalidMethod.class, "invalidMethod", annotation);
final IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> loggingListener.testStarted(testDescription));
assertThat(e.getMessage(), equalTo("invalid test logging annotation [abc:INFO:WARN]"));
}
use of org.elasticsearch.test.junit.listeners.LoggingListener in project crate by crate.
the class LoggingListenerTests method testInvalidClassTestLoggingAnnotation.
public void testInvalidClassTestLoggingAnnotation() throws Exception {
final LoggingListener loggingListener = new LoggingListener();
final Description suiteDescription = Description.createSuiteDescription(InvalidClass.class);
final IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> loggingListener.testRunStarted(suiteDescription));
assertThat(e.getMessage(), equalTo("invalid test logging annotation [abc]"));
}
Aggregations