mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Fixed tests
This commit is contained in:
@@ -9,6 +9,7 @@ package org.dspace.app.rest;
|
||||
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
|
||||
@@ -252,8 +253,10 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
|
||||
|
||||
getClient().perform(get("/api/core/relationships/" + firstRelationshipIdString))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.leftId", is(publication.getID().toString())))
|
||||
.andExpect(jsonPath("$.rightId", is(author1.getID().toString())));
|
||||
.andExpect(jsonPath("$._links.leftItem.href",
|
||||
containsString(publication.getID().toString())))
|
||||
.andExpect(jsonPath("$._links.rightItem.href",
|
||||
containsString(author1.getID().toString())));
|
||||
|
||||
}
|
||||
|
||||
@@ -325,8 +328,8 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
|
||||
|
||||
getClient().perform(get("/api/core/relationships/" + firstRelationshipIdString))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.leftId", is(publication.getID().toString())))
|
||||
.andExpect(jsonPath("$.rightId", is(author1.getID().toString())));
|
||||
.andExpect(jsonPath("$._links.leftItem.href", containsString(publication.getID().toString())))
|
||||
.andExpect(jsonPath("$._links.rightItem.href", containsString(author1.getID().toString())));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.app.rest.csv;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
@@ -91,13 +92,13 @@ public class CsvImportIT extends AbstractEntityIntegrationTest {
|
||||
getClient().perform(get("/api/core/relationships/" + relationships.get(0).getID()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.leftPlace", is(0)))
|
||||
.andExpect(jsonPath("$.rightId", is(itemC.getID().toString())))
|
||||
.andExpect(jsonPath("$._links.rightItem.href", containsString(itemC.getID().toString())))
|
||||
.andExpect(jsonPath("$.rightPlace", is(1)))
|
||||
.andExpect(jsonPath("$", Matchers.is(RelationshipMatcher.matchRelationship(relationships.get(0)))));
|
||||
getClient().perform(get("/api/core/relationships/" + relationships.get(1).getID().toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.leftPlace", is(1)))
|
||||
.andExpect(jsonPath("$.rightId", is(itemB.getID().toString())))
|
||||
.andExpect(jsonPath("$._links.rightItem.href", containsString(itemB.getID().toString())))
|
||||
.andExpect(jsonPath("$.rightPlace", is(1)))
|
||||
.andExpect(jsonPath("$", Matchers.is(RelationshipMatcher.matchRelationship(relationships.get(1)))));
|
||||
|
||||
|
@@ -9,6 +9,7 @@ package org.dspace.app.rest.matcher;
|
||||
|
||||
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -39,8 +40,8 @@ public class RelationshipMatcher {
|
||||
int leftPlace, int rightPlace,
|
||||
RelationshipType relationshipType) {
|
||||
return allOf(
|
||||
hasJsonPath("$.leftId", is(leftId.toString())),
|
||||
hasJsonPath("$.rightId", is(rightId.toString())),
|
||||
hasJsonPath("$._links.leftItem.href", containsString(leftId.toString())),
|
||||
hasJsonPath("$._links.rightItem.href", containsString(rightId.toString())),
|
||||
hasJsonPath("$.leftPlace", is(leftPlace)),
|
||||
hasJsonPath("$.rightPlace", is(rightPlace)),
|
||||
hasJsonPath("$._embedded.relationshipType",
|
||||
|
Reference in New Issue
Block a user