use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class QueryErrorClassifierTest method shouldChainDiffering.
@Test
public void shouldChainDiffering() {
// Given:
when(classifierA.classify(any())).thenReturn(Type.USER);
when(classifierB.classify(any())).thenReturn(Type.SYSTEM);
// When:
final Type type = classifierA.and(classifierB).classify(error);
// Then:
assertThat(type, is(Type.UNKNOWN));
}
use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class QueryErrorClassifierTest method shouldChainSomethingUnknown.
@Test
public void shouldChainSomethingUnknown() {
// Given:
when(classifierA.classify(any())).thenReturn(Type.USER);
when(classifierB.classify(any())).thenReturn(Type.UNKNOWN);
// When:
final Type type = classifierA.and(classifierB).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 shouldClassifyWithRegex.
@Test
public void shouldClassifyWithRegex() {
// Given:
final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER .*foo.*", "id");
givenMessage(error, "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 shouldClassifyAsUnknownIfBadRegex.
@Test
public void shouldClassifyAsUnknownIfBadRegex() {
// Given:
final QueryErrorClassifier classifier = RegexClassifier.fromConfig("USER", "id");
givenMessage(error, "foo");
// When:
final Type type = classifier.classify(error);
// Then:
assertThat(type, is(Type.UNKNOWN));
}
use of io.confluent.ksql.query.QueryError.Type in project ksql by confluentinc.
the class AuthorizationClassifierTest method shouldClassifyAuthorizationExceptionAsUserError.
@Test
public void shouldClassifyAuthorizationExceptionAsUserError() {
// Given:
final Exception e = new AuthorizationException("foo");
// When:
final Type type = new AuthorizationClassifier("").classify(e);
// Then:
assertThat(type, is(Type.USER));
}
Aggregations