assertNotNull( m );
assertEquals( 1, m.lhs.length );
assertTrue( m.lhs[ 0 ] instanceof FactPattern );
assertTrue( ( (FactPattern) m.lhs[ 0 ] ).getFieldConstraints()[ 0 ] instanceof SingleFieldConstraintEBLeftSide );
SingleFieldConstraintEBLeftSide ebLeftSide = (SingleFieldConstraintEBLeftSide) ( (FactPattern) m.lhs[ 0 ] ).getFieldConstraints()[ 0 ];
assertEquals( "postalCode",
ebLeftSide.getFieldName() );
assertEquals( "java.lang.Integer",
ebLeftSide.getFieldType() );
assertEquals( "==",
ebLeftSide.getOperator() );
assertEquals( "",
ebLeftSide.getValue() );
assertEquals( 3, ebLeftSide.getExpressionValue().getParts().size() );
assertTrue( ebLeftSide.getExpressionValue().getParts().get( 0 ) instanceof ExpressionVariable );
ExpressionVariable expressionVariable = (ExpressionVariable) ebLeftSide.getExpressionValue().getParts().get( 0 );
assertEquals( "p",
expressionVariable.getName() );
assertEquals( "org.test.Person",
expressionVariable.getClassType() );
assertEquals( DataType.TYPE_THIS,
expressionVariable.getGenericType() );
assertTrue( ebLeftSide.getExpressionValue().getParts().get( 1 ) instanceof ExpressionField );
ExpressionField ef1 = (ExpressionField) ebLeftSide.getExpressionValue().getParts().get( 1 );
assertEquals( "address",
ef1.getName() );
assertEquals( "org.test.Address",
ef1.getClassType() );
assertEquals( "Address",
ef1.getGenericType() );
assertTrue( ebLeftSide.getExpressionValue().getParts().get( 2 ) instanceof ExpressionField );
ExpressionField ef2 = (ExpressionField) ebLeftSide.getExpressionValue().getParts().get( 2 );
assertEquals( "postalCode",
ef2.getName() );
assertEquals( "java.lang.Integer",
ef2.getClassType() );
assertEquals( DataType.TYPE_NUMERIC_INTEGER,
ef2.getGenericType() );
assertEquals( 3, ebLeftSide.getExpressionLeftSide().getParts().size() );
assertTrue( ebLeftSide.getExpressionLeftSide().getParts().get( 0 ) instanceof ExpressionUnboundFact );
ExpressionUnboundFact expressionUnboundFact = ( (ExpressionUnboundFact) ebLeftSide.getExpressionLeftSide().getParts().get( 0 ) );
assertEquals( "Person",
expressionUnboundFact.getName() );
assertEquals( "Person",
expressionUnboundFact.getClassType() );
assertEquals( "Person",
expressionUnboundFact.getGenericType() );
assertEquals( m.lhs[ 0 ],
expressionUnboundFact.getFact() );
assertNull( expressionUnboundFact.getPrevious() );
assertEquals( ebLeftSide.getExpressionLeftSide().getParts().get( 1 ), expressionUnboundFact.getNext() );
assertTrue( ebLeftSide.getExpressionLeftSide().getParts().get( 1 ) instanceof ExpressionField );
ExpressionField expressionField1 = (ExpressionField) ebLeftSide.getExpressionLeftSide().getParts().get( 1 );
assertEquals( "address",
expressionField1.getName() );
assertEquals( "org.test.Address",
expressionField1.getClassType() );
assertEquals( "Address",
expressionField1.getGenericType() );
assertEquals( ebLeftSide.getExpressionLeftSide().getParts().get( 0 ), expressionField1.getPrevious() );
assertEquals( ebLeftSide.getExpressionLeftSide().getParts().get( 2 ), expressionField1.getNext() );
assertTrue( ebLeftSide.getExpressionLeftSide().getParts().get( 2 ) instanceof ExpressionField );
ExpressionField expressionField2 = (ExpressionField) ebLeftSide.getExpressionLeftSide().getParts().get( 2 );
assertEquals( "postalCode",
expressionField2.getName() );
assertEquals( "java.lang.Integer",
expressionField2.getClassType() );
assertEquals( DataType.TYPE_NUMERIC_INTEGER,
expressionField2.getGenericType() );
assertEquals( ebLeftSide.getExpressionLeftSide().getParts().get( 1 ), expressionField2.getPrevious() );
assertNull( expressionField2.getNext() );
}