mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 22:43:12 +00:00
Final removal of JMockit. Move last tests to Mockito. Cleanup unused tests & resources
This commit is contained in:
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeNotNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
@@ -36,6 +37,7 @@ import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.WorkspaceItemService;
|
||||
import org.dspace.identifier.doi.DOIConnector;
|
||||
import org.dspace.identifier.factory.IdentifierServiceFactory;
|
||||
import org.dspace.identifier.service.DOIService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
@@ -48,7 +50,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests for {@link DataCiteIdentifierProvider}.
|
||||
* Tests for {@link DOIIdentifierProvider}.
|
||||
*
|
||||
* @author Mark H. Wood
|
||||
* @author Pascal-Nicolas Becker
|
||||
@@ -75,7 +77,7 @@ public class DOIIdentifierProviderTest
|
||||
private static Community community;
|
||||
private static Collection collection;
|
||||
|
||||
private static MockDOIConnector connector;
|
||||
private static DOIConnector connector;
|
||||
private DOIIdentifierProvider provider;
|
||||
|
||||
public DOIIdentifierProviderTest() {
|
||||
@@ -111,7 +113,7 @@ public class DOIIdentifierProviderTest
|
||||
config.setProperty(DOIIdentifierProvider.CFG_NAMESPACE_SEPARATOR,
|
||||
NAMESPACE_SEPARATOR);
|
||||
|
||||
connector = new MockDOIConnector();
|
||||
connector = mock(DOIConnector.class);
|
||||
|
||||
provider = DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName(DOIIdentifierProvider.class.getName(),
|
||||
@@ -140,7 +142,6 @@ public class DOIIdentifierProviderTest
|
||||
public void destroy() {
|
||||
community = null;
|
||||
collection = null;
|
||||
connector.reset();
|
||||
connector = null;
|
||||
provider = null;
|
||||
super.destroy();
|
||||
@@ -261,14 +262,13 @@ public class DOIIdentifierProviderTest
|
||||
|
||||
@Test
|
||||
public void testSupports_valid_String() {
|
||||
String[] validDOIs = new String[]
|
||||
{
|
||||
"10.5072/123abc-lkj/kljl",
|
||||
PREFIX + "/" + NAMESPACE_SEPARATOR + "lkjljasd1234",
|
||||
DOI.SCHEME + "10.5072/123abc-lkj/kljl",
|
||||
"http://dx.doi.org/10.5072/123abc-lkj/kljl",
|
||||
DOI.RESOLVER + "/10.5072/123abc-lkj/kljl"
|
||||
};
|
||||
String[] validDOIs = new String[] {
|
||||
"10.5072/123abc-lkj/kljl",
|
||||
PREFIX + "/" + NAMESPACE_SEPARATOR + "lkjljasd1234",
|
||||
DOI.SCHEME + "10.5072/123abc-lkj/kljl",
|
||||
"http://dx.doi.org/10.5072/123abc-lkj/kljl",
|
||||
DOI.RESOLVER + "/10.5072/123abc-lkj/kljl"
|
||||
};
|
||||
|
||||
for (String doi : validDOIs) {
|
||||
assertTrue("DOI should be supported", provider.supports(doi));
|
||||
@@ -277,13 +277,12 @@ public class DOIIdentifierProviderTest
|
||||
|
||||
@Test
|
||||
public void testDoes_not_support_invalid_String() {
|
||||
String[] invalidDOIs = new String[]
|
||||
{
|
||||
"11.5072/123abc-lkj/kljl",
|
||||
"http://hdl.handle.net/handle/10.5072/123abc-lkj/kljl",
|
||||
"",
|
||||
null
|
||||
};
|
||||
String[] invalidDOIs = new String[] {
|
||||
"11.5072/123abc-lkj/kljl",
|
||||
"http://hdl.handle.net/handle/10.5072/123abc-lkj/kljl",
|
||||
"",
|
||||
null
|
||||
};
|
||||
|
||||
for (String notADoi : invalidDOIs) {
|
||||
assertFalse("Invalid DOIs shouldn't be supported",
|
||||
|
Reference in New Issue
Block a user