assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented(FooService.class.getName()));
assertTrue("Check Bar Service implementation", manip.isInterfaceImplemented(BarService.class.getName()));
}
public void testFields() {
PojoMetadata manip = FooProviderTypeDyn;
FieldMetadata[] fields = manip.getFields();
assertEquals("Check field count + " + fields.length, fields.length, 5);
/*
private int intProp;
private String strProp;
private String[] strAProp;
private int[] intAProp;
private boolean boolProp;
*/
FieldMetadata field;
field = manip.getField("intProp");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "int");
field = manip.getField("intProp", "int");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
field = manip.getField("intProp", "long");
assertNull("Check bad field", field);
field = manip.getField("strProp");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "java.lang.String");
field = manip.getField("strProp", "String");
assertNull("Check bad field", field);
field = manip.getField("strProp", "java.lang.String");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
field = manip.getField("strAProp");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[Ljava.lang.String;");
field = manip.getField("strAProp", "java.lang.String[]");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
field = manip.getField("strAProp", "String[]");
assertNull("Check bad field", field);
field = manip.getField("intAProp");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[I");
field = manip.getField("intAProp", "int[]");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
field = manip.getField("intAProp", "String[]");
assertNull("Check bad field", field);
field = manip.getField("boolProp");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "boolean");
field = manip.getField("boolProp", "boolean");
assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
field = manip.getField("boolProp", "bool");
assertNull("Check bad field", field);
}