fp0.setBoundName( "$t0" );
fp0.setFactType( "FT0" );
SingleFieldConstraintEBLeftSide sfc0 = new SingleFieldConstraintEBLeftSide();
ExpressionFormLine eflhs0 = new ExpressionFormLine();
eflhs0.setBinding( "$eflhs0" );
ExpressionText eflhs0p0 = new ExpressionText( "eflhs0p0" );
eflhs0.appendPart( eflhs0p0 );
sfc0.setExpressionLeftSide( eflhs0 );
ExpressionFormLine efl0 = new ExpressionFormLine();
efl0.setBinding( "$efl0" );
ExpressionText efl0p0 = new ExpressionText( "efl0p0" );
efl0.appendPart( efl0p0 );
sfc0.setExpressionValue( efl0 );
fp0.addConstraint( sfc0 );
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 FactPattern );
FactPattern fp0Clone = (FactPattern) clone.lhs[0];
assertEquals( fp0.getBoundName(),
fp0Clone.getBoundName() );
assertEquals( fp0.getFactType(),
fp0Clone.getFactType() );
assertEquals( 1,
fp0Clone.constraintList.constraints.length );
assertNotSame( fp0.constraintList.constraints[0],
fp0Clone.constraintList.constraints[0] );
assertNotNull( fp0Clone.constraintList.constraints[0] );
assertTrue( fp0Clone.constraintList.constraints[0] instanceof SingleFieldConstraintEBLeftSide );
SingleFieldConstraintEBLeftSide sfc0Clone = (SingleFieldConstraintEBLeftSide) fp0Clone.constraintList.constraints[0];
assertNotSame( sfc0.getExpressionLeftSide(),
sfc0Clone.getExpressionLeftSide() );
assertNotNull( sfc0Clone.getExpressionLeftSide() );
assertTrue( sfc0Clone.getExpressionLeftSide() instanceof ExpressionFormLine );
ExpressionFormLine eflhs0Clone = (ExpressionFormLine) sfc0Clone.getExpressionLeftSide();
assertEquals( 1,
sfc0Clone.getExpressionLeftSide().getParts().size() );
assertTrue( sfc0Clone.getExpressionLeftSide().getParts().get( 0 ) instanceof ExpressionText );
ExpressionText eflhs0p0Clone = (ExpressionText) sfc0Clone.getExpressionLeftSide().getParts().get( 0 );
assertEquals( eflhs0p0.getClassType(),
eflhs0p0Clone.getClassType() );
assertEquals( eflhs0p0.getName(),
eflhs0p0Clone.getName() );
assertEquals( eflhs0p0.getGenericType(),
eflhs0p0Clone.getGenericType() );
assertEquals( eflhs0p0.getParametricType(),
eflhs0p0Clone.getParametricType() );
assertEquals( eflhs0.getBinding(),
eflhs0Clone.getBinding() );
assertEquals( eflhs0.getClassType(),
eflhs0Clone.getClassType() );
assertEquals( eflhs0.getFieldName(),
eflhs0Clone.getFieldName() );
assertEquals( eflhs0.getGenericType(),
eflhs0Clone.getGenericType() );
assertEquals( eflhs0.getParametricType(),
eflhs0Clone.getParametricType() );
assertEquals( eflhs0.getCurrentName(),
eflhs0Clone.getCurrentName() );
assertNotSame( sfc0.getExpressionValue(),
sfc0Clone.getExpressionValue() );
assertNotNull( sfc0Clone.getExpressionValue() );
assertTrue( sfc0Clone.getExpressionValue() instanceof ExpressionFormLine );
ExpressionFormLine efl0Clone = (ExpressionFormLine) sfc0Clone.getExpressionValue();
assertEquals( 1,
sfc0Clone.getExpressionValue().getParts().size() );
assertTrue( sfc0Clone.getExpressionValue().getParts().get( 0 ) instanceof ExpressionText );
ExpressionText efl0p0Clone = (ExpressionText) sfc0Clone.getExpressionValue().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() );
}