@Test public void testTransform() throws Exception { Path output = folder.newFolder("output").toPath(); JavaTransformer transformer = new JavaTransformer(); val targetClass = this.getClass().getName(); BooleanHolder holder = new BooleanHolder(false); transformer.addTransformer( c -> { System.out.println( "Transforming class: " + c.getName() + " of type " + c.getClass().getSimpleName()); if (c.getName().equals(targetClass)) { holder.value = true; } }); transformer.transform(input, output); Assert.assertTrue("Transformer must process " + targetClass, holder.value); Assert.assertTrue(exists(output.resolve("me/nallar/javatransformer/api/JavaTransformerTest."))); }
private static Path getClassPath() { return JavaTransformer.pathFromClass(JavaTransformerTest.class); }