mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 23:43:06 +00:00
Remove deprecated getMetadata(Context, String) from CommunityService, CollectionService.
This commit is contained in:
@@ -12,6 +12,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -33,6 +34,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.Group;
|
||||
@@ -297,19 +299,6 @@ public class CommunityTest extends AbstractDSpaceObjectTest {
|
||||
assertTrue("testGetHandle 0", c.getHandle().contains("123456789/"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getMetadata method, of class Community.
|
||||
*/
|
||||
@Test
|
||||
public void testGetMetadata() {
|
||||
//by default all empty values will return ""
|
||||
assertThat("testGetMetadata 0", communityService.getMetadata(c, "name"), equalTo(""));
|
||||
assertThat("testGetMetadata 1", communityService.getMetadata(c, "short_description"), equalTo(""));
|
||||
assertThat("testGetMetadata 2", communityService.getMetadata(c, "introductory_text"), equalTo(""));
|
||||
assertThat("testGetMetadata 4", communityService.getMetadata(c, "copyright_text"), equalTo(""));
|
||||
assertThat("testGetMetadata 5", communityService.getMetadata(c, "side_bar_text"), equalTo(""));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of setMetadata method, of class Community.
|
||||
*/
|
||||
@@ -327,11 +316,16 @@ public class CommunityTest extends AbstractDSpaceObjectTest {
|
||||
communityService.setMetadata(context, c, "copyright_text", copy);
|
||||
communityService.setMetadata(context, c, "side_bar_text", sidebar);
|
||||
|
||||
assertThat("testSetMetadata 0", communityService.getMetadata(c, "name"), equalTo(name));
|
||||
assertThat("testSetMetadata 1", communityService.getMetadata(c, "short_description"), equalTo(sdesc));
|
||||
assertThat("testSetMetadata 2", communityService.getMetadata(c, "introductory_text"), equalTo(itext));
|
||||
assertThat("testSetMetadata 4", communityService.getMetadata(c, "copyright_text"), equalTo(copy));
|
||||
assertThat("testSetMetadata 5", communityService.getMetadata(c, "side_bar_text"), equalTo(sidebar));
|
||||
assertEquals("Name not set properly.", name,
|
||||
communityService.getMetadataFirstValue(c, CommunityService.MD_NAME, Item.ANY));
|
||||
assertEquals("Short description not set properly.", sdesc,
|
||||
communityService.getMetadataFirstValue(c, CommunityService.MD_SHORT_DESCRIPTION, Item.ANY));
|
||||
assertEquals("Introductory text not set properly.", itext,
|
||||
communityService.getMetadataFirstValue(c, CommunityService.MD_INTRODUCTORY_TEXT, Item.ANY));
|
||||
assertEquals("Copyright text not set properly.", copy,
|
||||
communityService.getMetadataFirstValue(c, CommunityService.MD_COPYRIGHT_TEXT, Item.ANY));
|
||||
assertEquals("Sidebar text not set properly.", sidebar,
|
||||
communityService.getMetadataFirstValue(c, CommunityService.MD_SIDEBAR_TEXT, Item.ANY));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -580,7 +574,7 @@ public class CommunityTest extends AbstractDSpaceObjectTest {
|
||||
public void testGetAllCollections() throws Exception {
|
||||
//empty by default
|
||||
assertThat("testGetAllCollections 0", communityService.getAllCollections(context, c), notNullValue());
|
||||
assertTrue("testGetAllCollections 1", communityService.getAllCollections(context, c).size() == 0);
|
||||
assertTrue("testGetAllCollections 1", communityService.getAllCollections(context, c).isEmpty());
|
||||
|
||||
//community has a collection and a subcommunity, subcommunity has a collection
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
Reference in New Issue
Block a user