DATAREST-1410 - Migrate remaining tests to AssertJ.

This commit is contained in:
Mark Paluch
2019-07-31 10:06:03 +02:00
parent 314e0bb6f4
commit 19c261d7d0
33 changed files with 164 additions and 254 deletions

View File

@@ -34,7 +34,7 @@ import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@@ -47,7 +47,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
* @author Oliver Gierke
* @soundtrack Miles Davis - Blue in green (Kind of blue)
*/
@RunWith(SpringJUnit4ClassRunner.class)
@RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration
public class HalBrowserIntegrationTests {

View File

@@ -15,9 +15,7 @@
*/
package org.springframework.data.rest.webmvc.halbrowser;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
import static org.assertj.core.api.Assertions.*;
import java.io.IOException;
import java.util.Collections;
@@ -26,6 +24,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -61,7 +60,7 @@ public class HalBrowserUnitTests {
UriComponents components = UriComponentsBuilder.fromUriString(response.getHeader(HttpHeaders.LOCATION)).build();
assertThat(components.getPath(), startsWith("/context"));
assertThat(components.getPath()).startsWith("/context");
assertThat(components.getFragment()).isEqualTo("/context");
}
@@ -83,8 +82,7 @@ public class HalBrowserUnitTests {
String url = ((RedirectView) view).getUrl();
assertThat(url, startsWith("https://somehost:4711/prefix"));
assertThat(url, endsWith("/prefix"));
assertThat(url).startsWith("https://somehost:4711/prefix").endsWith("/prefix");
});
}
}