@Test
public void createConsequence() {

    CreatedClass aClass = new MaterializedLambdaConsequence("org.drools.modelcompiler.util.lambdareplace", "rulename", new ArrayList<>())
            .create("(org.drools.modelcompiler.domain.Person p1, org.drools.modelcompiler.domain.Person p2) -> result.setValue( p1.getName() + \" is older than \" + p2.getName())", new ArrayList<>(), new ArrayList<>());
    //language=JAVA
    String expectedResult = "" +
            "package org.drools.modelcompiler.util.lambdareplace.PF2;\n" +
            "import static rulename.*; " +
            "import org.drools.modelcompiler.dsl.pattern.D; " +
            "\n"+
            "@org.drools.compiler.kie.builder.MaterializedLambda() " +
            "public enum LambdaConsequenceF23B77D6BCFA8D6EB3EC2C02BACF2BEA implements org.drools.model.functions.Block2<org.drools.modelcompiler.domain.Person, org.drools.modelcompiler.domain.Person>  {\n" +
            "INSTANCE;\n" +
            "public static final String EXPRESSION_HASH = \"8305FF24AC76CB49E7AAE2C10356A105\";" +
            "        @Override()\n" +
            "        public void execute(org.drools.modelcompiler.domain.Person p1, org.drools.modelcompiler.domain.Person p2) throws java.lang.Exception {\n" +
            "            result.setValue(p1.getName() + \" is older than \" + p2.getName());\n" +
            "        }\n" +
            "    }\n";
    assertThat(aClass.getCompilationUnitAsString(), equalToIgnoringWhiteSpace(expectedResult));
}