final LiteralConstraint literalConstarint = (LiteralConstraint) pattern.getConstraints().get( 0 );
}
public void testNumbers() throws Exception {
// test boolean
FieldConstraintDescr literalDescr = new FieldConstraintDescr( "booleanPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"true" ) );
createLiteralRule( literalDescr );
// test boolean
literalDescr = new FieldConstraintDescr( "booleanPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"false" ) );
createLiteralRule( literalDescr );
// test char
literalDescr = new FieldConstraintDescr( "charPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"a" ) );
createLiteralRule( literalDescr );
// test byte
literalDescr = new FieldConstraintDescr( "bytePrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"1" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "bytePrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "bytePrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"-1" ) );
createLiteralRule( literalDescr );
// test short
literalDescr = new FieldConstraintDescr( "shortPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"1" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "shortPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "shortPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"-1" ) );
createLiteralRule( literalDescr );
// test int
literalDescr = new FieldConstraintDescr( "intPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"1" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "intPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "intPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"-1" ) );
createLiteralRule( literalDescr );
// test long
literalDescr = new FieldConstraintDescr( "longPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"1" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "longPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "longPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
// test float
literalDescr = new FieldConstraintDescr( "floatPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"1.1" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "floatPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "floatPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"-1.1" ) );
createLiteralRule( literalDescr );
// test double
literalDescr = new FieldConstraintDescr( "doublePrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"1.1" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "doublePrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"0" ) );
createLiteralRule( literalDescr );
literalDescr = new FieldConstraintDescr( "floatPrimitive" );
literalDescr.addRestriction( new LiteralRestrictionDescr( "==",
"-1.1" ) );
createLiteralRule( literalDescr );
}