use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class AuthorizationClassifierTest method shouldClassifySubTypeOfAuthorizationExceptionAsUserError.
@Test
public void shouldClassifySubTypeOfAuthorizationExceptionAsUserError() {
// Given:
final Exception e = new TopicAuthorizationException("foo");
// When:
final Type type = new AuthorizationClassifier("").classify(e);
// Then:
assertThat(type, is(Type.USER));
}
use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class AuthorizationClassifierTest method shouldClassifyNoTransactionalIdAuthorizationExceptionAsUnknownError.
@Test
public void shouldClassifyNoTransactionalIdAuthorizationExceptionAsUnknownError() {
// Given:
final Exception e = new Exception("foo");
// When:
final Type type = new AuthorizationClassifier("").classify(e);
// Then:
assertThat(type, is(Type.UNKNOWN));
}
use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class AuthorizationClassifierTest method shouldClassifyWrappedAuthorizationExceptionAsUserError.
@Test
public void shouldClassifyWrappedAuthorizationExceptionAsUserError() {
// Given:
final Exception e = new StreamsException(new AuthorizationException("foo"));
// When:
final Type type = new AuthorizationClassifier("").classify(e);
// Then:
assertThat(type, is(Type.USER));
}
use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class RegexClassifierTest method shouldClassifyWithRegexInCause.
@Test
public void shouldClassifyWithRegexInCause() {
// Given:
final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER .*foo.*", "id");
when(error.getCause()).thenReturn(cause);
givenMessage(error, "bar");
givenMessage(cause, "foo");
// When:
final Type type = classifier.classify(error);
// Then:
assertThat(type, is(Type.USER));
}
use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class RegexClassifierTest method shouldClassifyNPEIfConfigured.
@Test
public void shouldClassifyNPEIfConfigured() {
// Given:
final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER .*NullPointerException", "id");
// When:
final Type type = classifier.classify(npe());
// Then:
assertThat(type, is(Type.USER));
}
Aggregations