collection.add(testObject);
testObject = new OCLCollectionsTestObject();
testObject.setPropertyOne("propertyOneAgain");
collection.add(testObject);
assertEquals(2, collection.size());
assertTrue(OCLCollections.isUnique(collection, new Transformer()
{
public Object transform(Object object)
{
return OCLIntrospector.invoke(object, "propertyOne");
}
}));
assertTrue(OCLCollections.isUnique((Object) collection, new Transformer()
{
public Object transform(Object object)
{
return OCLIntrospector.invoke(object, "propertyOne");
}
}));
testObject = new OCLCollectionsTestObject();
testObject.setPropertyOne("propertyOne");
collection.add(testObject);
assertEquals(3, collection.size());
assertFalse(OCLCollections.isUnique(collection, new Transformer()
{
public Object transform(Object object)
{
return OCLIntrospector.invoke(object, "propertyOne");
}
}));
assertFalse(OCLCollections.isUnique((Object) collection, new Transformer()
{
public Object transform(Object object)
{
return OCLIntrospector.invoke(object, "propertyOne");
}
}));
collection.remove(testObject);
assertEquals(2, collection.size());
assertTrue(OCLCollections.isUnique(collection, new Transformer()
{
public Object transform(Object object)
{
return OCLIntrospector.invoke(object, "propertyOne");
}
}));
assertTrue(OCLCollections.isUnique((Object) collection, new Transformer()
{
public Object transform(Object object)
{
return OCLIntrospector.invoke(object, "propertyOne");
}