DATAREST-1356 - Polishing.

This commit is contained in:
Greg Turnquist
2019-10-21 13:03:04 -05:00
parent 202a8aa302
commit b016c0b125
2 changed files with 8 additions and 7 deletions

View File

@@ -20,12 +20,11 @@ import static org.hamcrest.CoreMatchers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import net.minidev.json.JSONArray;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import net.minidev.json.JSONArray;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -121,7 +120,8 @@ public abstract class AbstractWebIntegrationTests {
String href = link.isTemplated() ? link.expand().getHref() : link.getHref();
MockHttpServletResponse response = mvc.perform(put(href).content(payload.toString()).contentType(mediaType))//
.andExpect(status().is5xxServerError()).andReturn().getResponse();
.andExpect(status().is5xxServerError())//
.andReturn().getResponse();
return StringUtils.hasText(response.getContentAsString()) ? response : client.request(link);
}

View File

@@ -17,21 +17,20 @@ package org.springframework.data.rest.webmvc.jpa;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.*;
import static org.springframework.data.rest.webmvc.util.TestUtils.*;
import static org.springframework.http.HttpHeaders.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import net.minidev.json.JSONArray;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.minidev.json.JSONArray;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -712,6 +711,7 @@ public class JpaWebTests extends CommonWebTests {
* @return link to creator of order (associative link for given order instance)
*/
private Link prepareOrderResource(Order order) throws Exception {
Link orderLink = client.discoverUnique(LinkRelation.of("orders"));
MockHttpServletResponse primaryResponse = postAndGet(orderLink, mapper.writeValueAsString(order),
@@ -723,6 +723,7 @@ public class JpaWebTests extends CommonWebTests {
* @return link to given person (canonical, self, link)
*/
private Link preparePersonResource(Person person) throws Exception {
Link orderLink = client.discoverUnique(LinkRelation.of("people"));
MockHttpServletResponse primaryResponse = postAndGet(orderLink, mapper.writeValueAsString(person),
@@ -773,7 +774,7 @@ public class JpaWebTests extends CommonWebTests {
private static String toUriList(Link... links) {
List<String> uris = new ArrayList<String>(links.length);
List<String> uris = new ArrayList<>(links.length);
for (Link link : links) {
uris.add(link.expand().getHref());