@Test
public void testFromCompositeFactPattern() {
RuleModel model = new RuleModel();
model.lhs = new IPattern[1];
FromCompositeFactPattern fp0 = new FromCompositeFactPattern();
ExpressionFormLine efl0 = new ExpressionFormLine();
efl0.setBinding( "$efl0" );
ExpressionText efl0p0 = new ExpressionText( "efl0p0" );
efl0.appendPart( efl0p0 );
fp0.setExpression( efl0 );
FactPattern fp0FactPattern = new FactPattern( "fp0FactPattern" );
fp0.setFactPattern( fp0FactPattern );
model.lhs[0] = fp0;
RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
RuleModel clone = cloneVisitor.visitRuleModel( model );
assertEquals( 1,
clone.lhs.length );
assertNotSame( model.lhs[0],
clone.lhs[0] );
assertNotNull( clone.lhs[0] );
assertTrue( clone.lhs[0] instanceof FromCompositeFactPattern );
FromCompositeFactPattern fp0Clone = (FromCompositeFactPattern) clone.lhs[0];
assertNotSame( fp0.getExpression(),
fp0Clone.getExpression() );
assertNotNull( fp0Clone.getExpression() );
assertTrue( fp0Clone.getExpression() instanceof ExpressionFormLine );
ExpressionFormLine efl0Clone = (ExpressionFormLine) fp0Clone.getExpression();
assertEquals( 1,
fp0Clone.getExpression().getParts().size() );
assertTrue( fp0Clone.getExpression().getParts().get( 0 ) instanceof ExpressionText );
ExpressionText efl0p0Clone = (ExpressionText) fp0Clone.getExpression().getParts().get( 0 );
assertEquals( efl0p0.getClassType(),
efl0p0Clone.getClassType() );
assertEquals( efl0p0.getName(),
efl0p0Clone.getName() );
assertEquals( efl0p0.getGenericType(),
efl0p0Clone.getGenericType() );
assertEquals( efl0p0.getParametricType(),
efl0p0Clone.getParametricType() );
assertEquals( efl0.getBinding(),
efl0Clone.getBinding() );
assertEquals( efl0.getClassType(),
efl0Clone.getClassType() );
assertEquals( efl0.getFieldName(),
efl0Clone.getFieldName() );
assertEquals( efl0.getGenericType(),
efl0Clone.getGenericType() );
assertEquals( efl0.getParametricType(),
efl0Clone.getParametricType() );
assertEquals( efl0.getCurrentName(),
efl0Clone.getCurrentName() );
assertNotSame( fp0.getFactPattern(),
fp0Clone.getFactPattern() );
assertNotNull( fp0Clone.getFactPattern() );
assertTrue( fp0Clone.getFactPattern() instanceof FactPattern );
FactPattern fp0FactPatternClone = (FactPattern) fp0Clone.getFactPattern();
assertEquals( fp0FactPattern.getBoundName(),
fp0FactPatternClone.getBoundName() );
assertEquals( fp0FactPattern.getFactType(),
fp0FactPatternClone.getFactType() );
}