@Test
  public void testFromAccumulateCompositePatternMissingValues() throws Exception {
    FactPattern pattern1 = new FactPattern("Person");
    SingleFieldConstraint constraint1 = new SingleFieldConstraint("name");
    constraint1.setOperator("==");
    pattern1.addConstraint(constraint1);

    FactPattern pattern2 = new FactPattern("Address");
    SingleFieldConstraint constraint2 = new SingleFieldConstraint("street");
    constraint2.setOperator("!=");
    pattern2.addConstraint(constraint2);

    FromAccumulateCompositeFactPattern fromAccumulateCompositeFactPattern =
        new FromAccumulateCompositeFactPattern();
    fromAccumulateCompositeFactPattern.setSourcePattern(pattern1);
    fromAccumulateCompositeFactPattern.setFactPattern(pattern2);
    fromAccumulateCompositeFactPattern.setFunction("test()");

    model.lhs = new IPattern[] {fromAccumulateCompositeFactPattern};

    assertFalse(validator.isValid());
    assertEquals(2, validator.getErrors().size());

    verify(constants, never()).WhenUsingFromTheSourceNeedsToBeSet();
    verify(constants)
        .FactType0HasAField1ThatHasAnOperatorSetButNoValuePleaseAddAValueOrRemoveTheOperator(
            "Person", "name");
    verify(constants)
        .FactType0HasAField1ThatHasAnOperatorSetButNoValuePleaseAddAValueOrRemoveTheOperator(
            "Address", "street");
  }
  @Test
  public void testFromAccumulateCompositePattern() throws Exception {
    FactPattern pattern1 = new FactPattern("Person");
    SingleFieldConstraint constraint1 = new SingleFieldConstraint("name");
    constraint1.setOperator("==");
    constraint1.setValue("Toni");
    pattern1.addConstraint(constraint1);

    FactPattern pattern2 = new FactPattern("Address");
    SingleFieldConstraint constraint2 = new SingleFieldConstraint("street");
    constraint2.setOperator("!=");
    constraint2.setValue("some street");
    pattern2.addConstraint(constraint2);

    FromAccumulateCompositeFactPattern fromAccumulateCompositeFactPattern =
        new FromAccumulateCompositeFactPattern();
    fromAccumulateCompositeFactPattern.setSourcePattern(pattern1);
    fromAccumulateCompositeFactPattern.setFactPattern(pattern2);
    ExpressionFormLine expression = new ExpressionFormLine();
    expression.setBinding("person.addresses");
    fromAccumulateCompositeFactPattern.setExpression(expression);

    model.lhs = new IPattern[] {fromAccumulateCompositeFactPattern};

    assertTrue(validator.isValid());
  }
  @Test
  public void testFromAccumulateCompositePatternMissingValues2() throws Exception {
    FactPattern pattern1 = new FactPattern("Person");

    FactPattern pattern2 = new FactPattern("Address");

    FromAccumulateCompositeFactPattern fromAccumulateCompositeFactPattern =
        new FromAccumulateCompositeFactPattern();
    fromAccumulateCompositeFactPattern.setSourcePattern(pattern1);
    fromAccumulateCompositeFactPattern.setFactPattern(pattern2);
    fromAccumulateCompositeFactPattern.setFunction("");
    fromAccumulateCompositeFactPattern.setReverseCode("");
    fromAccumulateCompositeFactPattern.setInitCode("");
    fromAccumulateCompositeFactPattern.setActionCode("");
    fromAccumulateCompositeFactPattern.setResultCode("");

    model.lhs = new IPattern[] {fromAccumulateCompositeFactPattern};

    assertFalse(validator.isValid());
    assertEquals(1, validator.getErrors().size());

    verify(constants).WhenUsingFromTheSourceNeedsToBeSet();
  }