Replace deprecated JUnit and Mockito statics. #2956

This commit is contained in:
Mark H. Wood
2020-11-18 16:12:41 -05:00
parent 7d64bb6f71
commit 87cfac01d4
39 changed files with 57 additions and 55 deletions

View File

@@ -8,7 +8,7 @@
package org.dspace.app.bulkedit; package org.dspace.app.bulkedit;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.BufferedWriter; import java.io.BufferedWriter;

View File

@@ -12,7 +12,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException; import java.sql.SQLException;

View File

@@ -11,8 +11,8 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;

View File

@@ -11,8 +11,8 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;

View File

@@ -12,7 +12,7 @@ import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;

View File

@@ -11,9 +11,9 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;

View File

@@ -12,9 +12,9 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;

View File

@@ -9,7 +9,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.Calendar; import java.util.Calendar;

View File

@@ -8,7 +8,7 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Locale; import java.util.Locale;

View File

@@ -8,7 +8,7 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@@ -9,7 +9,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@@ -9,7 +9,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;

View File

@@ -10,7 +10,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;

View File

@@ -8,8 +8,8 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;

View File

@@ -8,8 +8,8 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@@ -10,9 +10,9 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;

View File

@@ -8,7 +8,7 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
@@ -146,7 +146,7 @@ public class LicenseUtilsTest extends AbstractUnitTest {
locale = Locale.ENGLISH; locale = Locale.ENGLISH;
collection = collectionService.create(context, owningCommunity); collection = collectionService.create(context, owningCommunity);
item = installItemService.installItem(context, workspaceItemService.create(context, collection, false)); item = installItemService.installItem(context, workspaceItemService.create(context, collection, false));
additionalInfo = new HashMap<String, Object>(); additionalInfo = new HashMap<>();
additionalInfo.put("arg1", "arg1"); additionalInfo.put("arg1", "arg1");
additionalInfo.put("arg2", "arg2"); additionalInfo.put("arg2", "arg2");
additionalInfo.put("arg3", "arg3"); additionalInfo.put("arg3", "arg3");
@@ -177,7 +177,7 @@ public class LicenseUtilsTest extends AbstractUnitTest {
collection = collectionService.create(context, owningCommunity); collection = collectionService.create(context, owningCommunity);
collection.setLicense(context, templateLong); collection.setLicense(context, templateLong);
item = installItemService.installItem(context, workspaceItemService.create(context, collection, false)); item = installItemService.installItem(context, workspaceItemService.create(context, collection, false));
additionalInfo = new LinkedHashMap<String, Object>(); additionalInfo = new LinkedHashMap<>();
additionalInfo.put("arg1", "arg1"); additionalInfo.put("arg1", "arg1");
additionalInfo.put("arg2", "arg2"); additionalInfo.put("arg2", "arg2");
additionalInfo.put("arg3", "arg3"); additionalInfo.put("arg3", "arg3");

View File

@@ -10,7 +10,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;

View File

@@ -11,7 +11,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;

View File

@@ -10,7 +10,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@@ -8,8 +8,8 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException; import java.sql.SQLException;

View File

@@ -8,7 +8,7 @@
package org.dspace.content; package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException; import java.sql.SQLException;

View File

@@ -9,7 +9,7 @@ package org.dspace.content;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@@ -9,7 +9,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@@ -9,7 +9,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@@ -10,7 +10,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@@ -10,8 +10,8 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doNothing;

View File

@@ -9,8 +9,8 @@ package org.dspace.content.packager;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.File; import java.io.File;

View File

@@ -8,9 +8,9 @@
package org.dspace.content.packager; package org.dspace.content.packager;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException; import java.sql.SQLException;

View File

@@ -10,9 +10,9 @@ package org.dspace.core;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;

View File

@@ -10,7 +10,7 @@ package org.dspace.eperson;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@@ -8,7 +8,7 @@
package org.dspace.scripts; package org.dspace.scripts;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -8,7 +8,7 @@
package org.dspace.statistics.export; package org.dspace.statistics.export;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@@ -23,7 +23,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
/** /**
* Class to test the FailedOpenURLTrackerServiceImpl * Class to test the FailedOpenURLTrackerServiceImpl

View File

@@ -9,7 +9,7 @@ package org.dspace.statistics.export;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@@ -8,7 +8,7 @@
package org.dspace.statistics.export.processor; package org.dspace.statistics.export.processor;
import static org.hamcrest.core.Is.is; import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import java.io.File; import java.io.File;

View File

@@ -9,8 +9,8 @@ package org.dspace.statistics.export.processor;
import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.core.Is.is; import static org.hamcrest.core.Is.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

View File

@@ -8,7 +8,7 @@
package org.dspace.statistics.export.processor; package org.dspace.statistics.export.processor;
import static org.hamcrest.core.Is.is; import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@@ -32,11 +32,13 @@ import org.junit.Test;
public class ItemEventProcessorTest extends AbstractIntegrationTestWithDatabase { public class ItemEventProcessorTest extends AbstractIntegrationTestWithDatabase {
private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); private final ConfigurationService configurationService
= DSpaceServicesFactory.getInstance().getConfigurationService();
private String encodedUrl; private String encodedUrl;
@Before @Before
@Override
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
configurationService.setProperty("irus.statistics.tracker.enabled", true); configurationService.setProperty("irus.statistics.tracker.enabled", true);

View File

@@ -8,6 +8,7 @@
package org.dspace.statistics.export.service; package org.dspace.statistics.export.service;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.doCallRealMethod;
@@ -26,7 +27,6 @@ import java.util.List;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.statistics.export.OpenURLTracker; import org.dspace.statistics.export.OpenURLTracker;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
@@ -128,7 +128,7 @@ public class OpenUrlServiceImplTest {
String failedUrl = "failed-url"; String failedUrl = "failed-url";
openUrlService.logfailed(context, failedUrl); openUrlService.logfailed(context, failedUrl);
Assert.assertThat(tracker1.getUrl(), is(failedUrl)); assertThat(tracker1.getUrl(), is(failedUrl));
} }
} }

View File

@@ -7,6 +7,8 @@
*/ */
package org.dspace.workflowbasic; package org.dspace.workflowbasic;
import static org.hamcrest.MatcherAssert.assertThat;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
@@ -208,7 +210,7 @@ public class BasicWorkflowAuthorizationIT
} finally { } finally {
context.restoreAuthSystemState(); context.restoreAuthSystemState();
} }
Assert.assertThat("testsetWorkflowGroupSetsPermission 0", assertThat("testsetWorkflowGroupSetsPermission 0",
collectionService.getWorkflowGroup(context, collection, step), collectionService.getWorkflowGroup(context, collection, step),
CoreMatchers.equalTo(group)); CoreMatchers.equalTo(group));
Assert.assertTrue(groupService.isDirectMember(group, member)); Assert.assertTrue(groupService.isDirectMember(group, member));
@@ -230,11 +232,10 @@ public class BasicWorkflowAuthorizationIT
} finally { } finally {
context.restoreAuthSystemState(); context.restoreAuthSystemState();
} }
Assert assertThat("testsetWorkflowGroupRevokesPermission 0",
.assertThat("testsetWorkflowGroupRevokesPermission 0", collectionService.getWorkflowGroup(context, collection, step),
collectionService.getWorkflowGroup(context, collection, step), CoreMatchers
CoreMatchers .equalTo(group));
.equalTo(group));
Assert.assertTrue("testsetWorkflowGroupRevokesPermission 1", authorizeService Assert.assertTrue("testsetWorkflowGroupRevokesPermission 1", authorizeService
.authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true)); .authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true));
try { try {
@@ -244,17 +245,16 @@ public class BasicWorkflowAuthorizationIT
} finally { } finally {
context.restoreAuthSystemState(); context.restoreAuthSystemState();
} }
Assert assertThat("testsetWorkflowGroupRevokesPermission 2",
.assertThat("testsetWorkflowGroupRevokesPermission 2", collectionService.getWorkflowGroup(context, collection, step),
collectionService.getWorkflowGroup(context, collection, step), CoreMatchers
CoreMatchers .nullValue());
.nullValue());
Assert.assertFalse("testsetWorkflowGroupRevokesPermission 3", authorizeService Assert.assertFalse("testsetWorkflowGroupRevokesPermission 3", authorizeService
.authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true)); .authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true));
} }
/** /**
* Test that a member of a worfklow step group can claim a task and get the * Test that a member of a workflow step group can claim a task and get the
* appropriate policies. * appropriate policies.
*/ */
@Test @Test