DS-3406 unit tests for getCollection/getCommunity for different dspace objects

This commit is contained in:
frederic
2017-06-09 10:05:36 +02:00
committed by Tim Donohue
parent 4ae462041a
commit 7f252b6289
3 changed files with 82 additions and 34 deletions

View File

@@ -615,8 +615,18 @@ public class ItemTest extends AbstractDSpaceObjectTest
@Test
public void testGetCollections() throws Exception
{
context.turnOffAuthorisationSystem();
Collection collection = collectionService.create(context, owningCommunity);
collectionService.setMetadataSingleValue(context, collection, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY, "collection B");
it.addCollection(collection);
collection = collectionService.create(context, owningCommunity);
collectionService.setMetadataSingleValue(context, collection, MetadataSchema.DC_SCHEMA, "title", null, Item.ANY, "collection A");
it.addCollection(collection);
context.restoreAuthSystemState();
assertThat("testGetCollections 0", it.getCollections(), notNullValue());
assertTrue("testGetCollections 1", it.getCollections().size() == 1);
assertTrue("testGetCollections 1", it.getCollections().size() == 3);
assertTrue("testGetCollections 2", it.getCollections().get(1).getName().equals("collection A"));
assertTrue("testGetCollections 3", it.getCollections().get(2).getName().equals("collection B"));
}
/**