use of spoon.test.trycatch.testclasses.Foo in project spoon by INRIA.
the class TryCatchTest method testMultiTryCatchWithCustomExceptions.
@Test
public void testMultiTryCatchWithCustomExceptions() throws Exception {
final Launcher launcher = new Launcher();
final SpoonModelBuilder compiler = launcher.createCompiler();
compiler.addInputSource(new File("./src/test/java/spoon/test/trycatch/testclasses/"));
compiler.build();
Factory factory = compiler.getFactory();
final CtClass<?> foo = (CtClass<?>) factory.Type().get(Foo.class);
final CtCatch ctCatch = foo.getElements(new AbstractFilter<CtCatch>(CtCatch.class) {
@Override
public boolean matches(CtCatch element) {
return true;
}
}).get(0);
final String expected = "catch (spoon.test.trycatch.testclasses.internal.MyException | spoon.test.trycatch.testclasses.internal.MyException2 ignore) {" + System.lineSeparator() + "}";
assertEquals(expected, ctCatch.toString());
}
Aggregations