use of org.alfresco.rest.framework.tests.api.mocks2.FarmersSon in project alfresco-remote-api by Alfresco.
the class InspectorTests method testUniqueIdAnnotation.
@Test
public void testUniqueIdAnnotation() {
String uniqueId = ResourceInspector.findUniqueId(new Grass("34"));
assertNull(uniqueId);
uniqueId = ResourceInspector.findUniqueId(new Farmer("345"));
assertNotNull(uniqueId);
assertTrue("345".equals(uniqueId));
// inherited classes are ok (with overidden unique id method)
uniqueId = ResourceInspector.findUniqueId(new FarmersSon("567"));
assertNotNull(uniqueId);
assertTrue("567".equals(uniqueId));
// inherited classes are ok (with overidden unique id method but @UniqueId annotation not specified)
uniqueId = ResourceInspector.findUniqueId(new FarmersGrandson("12"));
assertNotNull(uniqueId);
assertTrue("12".equals(uniqueId));
// More than 1 annotation should throw IllegalArgumentException
try {
uniqueId = ResourceInspector.findUniqueId(new FarmersDaughter("21"));
fail("Should throw an InvalidArgumentException");
} catch (IllegalArgumentException error) {
// this is correct
}
}
Aggregations