@Test
public void createConsequenceWithMultipleFactUpdate() {

    ArrayList<String> personFields = new ArrayList<>();
    personFields.add("\"name\"");
    MaterializedLambda.BitMaskVariable bitMaskPerson = new MaterializedLambda.BitMaskVariableWithFields("DomainClassesMetadataB45236F6195B110E0FA3A5447BC53274.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE", personFields, "mask_$person");
    ArrayList<String> petFields = new ArrayList<>();
    petFields.add("\"age\"");
    MaterializedLambda.BitMaskVariable bitMaskPet = new MaterializedLambda.BitMaskVariableWithFields("DomainClassesMetadataB45236F6195B110E0FA3A5447BC53274.org_drools_modelcompiler_domain_Pet_Metadata_INSTANCE", petFields, "mask_$pet");
    String consequenceBlock = "(org.drools.model.Drools drools, org.drools.modelcompiler.domain.Pet $pet, org.drools.modelcompiler.domain.Person $person) -> {{ ($person).setName(\"George\");drools.update($person, mask_$person); ($pet).setAge($pet.getAge() + 1); drools.update($pet, mask_$pet); }}";
    CreatedClass aClass = new MaterializedLambdaConsequence("defaultpkg",
                                                            "defaultpkg.RulesB45236F6195B110E0FA3A5447BC53274",
                                                            Arrays.asList(bitMaskPerson, bitMaskPet))
            .create(consequenceBlock, new ArrayList<>(), new ArrayList<>());
    //language=JAVA
    String expectedResult = "" +
            "package defaultpkg.PB5;\n" +
            "import static defaultpkg.RulesB45236F6195B110E0FA3A5447BC53274.*; " +
            "import org.drools.modelcompiler.dsl.pattern.D; " +
            "\n"+
            "@org.drools.compiler.kie.builder.MaterializedLambda() " +
            "public enum LambdaConsequenceB5F5DCD7BB99BCAFC00F33AF0841B8C3 implements org.drools.model.functions.Block3<org.drools.model.Drools, org.drools.modelcompiler.domain.Pet, org.drools.modelcompiler.domain.Person> {\n" +
            "\n" +
            "    INSTANCE;\n" +
            "    public static final String EXPRESSION_HASH = \"2ABFB3D359AC0D0C1F6C1BAF91E05544\";\n" +
            "    private final org.drools.model.BitMask mask_$person = org.drools.model.BitMask.getPatternMask(DomainClassesMetadataB45236F6195B110E0FA3A5447BC53274.org_drools_modelcompiler_domain_Person_Metadata_INSTANCE, \"name\");\n" +
            "\n" +
            "    private final org.drools.model.BitMask mask_$pet = org.drools.model.BitMask.getPatternMask(DomainClassesMetadataB45236F6195B110E0FA3A5447BC53274.org_drools_modelcompiler_domain_Pet_Metadata_INSTANCE, \"age\");\n" +
            "\n" +
            "    @Override()\n" +
            "    public void execute(org.drools.model.Drools drools, org.drools.modelcompiler.domain.Pet $pet, org.drools.modelcompiler.domain.Person $person) throws java.lang.Exception {\n" +
            "        {\n" +
            "            ($person).setName(\"George\");\n" +
            "            drools.update($person, mask_$person);\n" +
            "            ($pet).setAge($pet.getAge() + 1);\n" +
            "            drools.update($pet, mask_$pet);\n" +
            "        }\n" +
            "    }\n" +
            "}";
    assertThat(aClass.getCompilationUnitAsString(), equalToIgnoringWhiteSpace(expectedResult));
}