mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 14:33:09 +00:00
[TLC-674] Checkstyle fixes for ITs
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
*/
|
||||
package org.dspace.content;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -29,11 +34,6 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
*
|
||||
* Integration tests for the duplicate detection service
|
||||
@@ -41,7 +41,8 @@ import static org.junit.Assert.fail;
|
||||
* @author Kim Shepherd
|
||||
*/
|
||||
public class DuplicateDetectionTest extends AbstractIntegrationTestWithDatabase {
|
||||
private DuplicateDetectionService duplicateDetectionService = ContentServiceFactory.getInstance().getDuplicateDetectionService();
|
||||
private DuplicateDetectionService duplicateDetectionService = ContentServiceFactory.getInstance()
|
||||
.getDuplicateDetectionService();
|
||||
private ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
private Collection col;
|
||||
private Collection workflowCol;
|
||||
@@ -224,7 +225,8 @@ public class DuplicateDetectionTest extends AbstractIntegrationTestWithDatabase
|
||||
try {
|
||||
potentialDuplicates = duplicateDetectionService.getPotentialDuplicates(context, item4);
|
||||
} catch (SearchServiceException e) {
|
||||
fail("Duplicate search with special characters should NOT result in search exception (" + e.getMessage() + ")");
|
||||
fail("Duplicate search with special characters should NOT result in search exception (" +
|
||||
e.getMessage() + ")");
|
||||
}
|
||||
|
||||
// Make sure result list is size 1
|
||||
@@ -256,7 +258,8 @@ public class DuplicateDetectionTest extends AbstractIntegrationTestWithDatabase
|
||||
//indexingService.commit();
|
||||
context.restoreAuthSystemState();
|
||||
context.setCurrentUser(admin);
|
||||
List<PotentialDuplicate> potentialDuplicates = duplicateDetectionService.getPotentialDuplicates(context, workflowItem1.getItem());
|
||||
List<PotentialDuplicate> potentialDuplicates =
|
||||
duplicateDetectionService.getPotentialDuplicates(context, workflowItem1.getItem());
|
||||
|
||||
// Make sure result list is size 1
|
||||
int size = 1;
|
||||
|
@@ -7,11 +7,17 @@
|
||||
*/
|
||||
package org.dspace.app.rest;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -45,12 +51,6 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
/**
|
||||
* Test item link and section data REST endpoints for duplicate detection.
|
||||
* @see DuplicateDetectionTest (dspace-api) for lower level integration tests.
|
||||
@@ -408,13 +408,15 @@ public class DuplicateDetectionRestIT extends AbstractControllerIntegrationTest
|
||||
String reviewerToken = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
// The reviewer should be able to see the workflow item as a potential duplicate of the test item
|
||||
getClient(reviewerToken).perform(get("/api/core/items/" + workflowItem1.getItem().getID() + "/duplicates"))
|
||||
getClient(reviewerToken).perform(get("/api/core/items/" + workflowItem1.getItem().getID()
|
||||
+ "/duplicates"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(contentType))
|
||||
// Valid duplicates array
|
||||
.andExpect(jsonPath("$._embedded.duplicates", Matchers.hasSize(1)))
|
||||
// UUID of only array member matches the new workflow item ID
|
||||
.andExpect(jsonPath("$._embedded.duplicates[0].uuid").value(workflowItem2.getItem().getID().toString()));
|
||||
.andExpect(jsonPath("$._embedded.duplicates[0].uuid")
|
||||
.value(workflowItem2.getItem().getID().toString()));
|
||||
|
||||
// Another random user will NOT see this
|
||||
getClient(getAuthToken(anotherEPerson.getEmail(), password))
|
||||
|
Reference in New Issue
Block a user