use of org.sonar.java.bytecode.se.testdata.ExceptionEnqueue in project sonar-java by SonarSource.
the class BytecodeEGWalkerTest method unchecked_exceptions_should_be_enqueued.
@Test
public void unchecked_exceptions_should_be_enqueued() {
MethodBehavior mb = getMethodBehavior(ExceptionEnqueue.class, "test(Lorg/sonar/java/bytecode/se/testdata/ExceptionEnqueue;)Ljava/lang/Object;");
List<Constraint> resultConstraint = mb.happyPathYields().map(y -> y.resultConstraint().get(ObjectConstraint.class)).collect(Collectors.toList());
assertThat(resultConstraint).contains(ObjectConstraint.NOT_NULL, ObjectConstraint.NULL);
List<String> exceptions = mb.exceptionalPathYields().map(y -> y.exceptionType(semanticModel).fullyQualifiedName()).collect(Collectors.toList());
assertThat(exceptions).contains("org.sonar.java.bytecode.se.testdata.ExceptionEnqueue$ExceptionCatch", "org.sonar.java.bytecode.se.testdata.ExceptionEnqueue$ThrowableCatch", "org.sonar.java.bytecode.se.testdata.ExceptionEnqueue$ErrorCatch");
}
Aggregations