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

@@ -18,7 +18,7 @@ package org.springframework.data.rest.webmvc.config;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
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;
@@ -29,7 +29,7 @@ import org.springframework.web.context.WebApplicationContext;
*
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
@RunWith(SpringRunner.class)
@WebAppConfiguration
public abstract class AbstractRepositoryRestMvcConfigurationIntegrationTests {

View File

@@ -15,9 +15,7 @@
*/
package org.springframework.data.rest.webmvc.json;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.assertj.core.api.Assertions.*;
import java.util.Arrays;
import java.util.HashMap;
@@ -25,6 +23,7 @@ import java.util.HashMap;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -42,13 +41,13 @@ import org.springframework.data.rest.tests.mongodb.User.Nested;
import org.springframework.data.rest.tests.mongodb.UserRepository;
import org.springframework.data.rest.webmvc.PersistentEntityResource;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.client.LinkDiscoverer;
import org.springframework.hateoas.PagedModel;
import org.springframework.hateoas.PagedModel.PageMetadata;
import org.springframework.hateoas.client.LinkDiscoverer;
import org.springframework.hateoas.mediatype.hal.HalLinkDiscoverer;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletWebRequest;
@@ -62,7 +61,7 @@ import com.jayway.jsonpath.JsonPath;
* @author Greg Turnquist
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = { MongoDbRepositoryConfig.class, RepositoryTestsConfig.class,
PersistentEntitySerializationTests.TestConfig.class })
public class PersistentEntitySerializationTests {
@@ -133,6 +132,6 @@ public class PersistentEntitySerializationTests {
.build(dave, repositories.getPersistentEntity(User.class)).build();
assertThat(JsonPath.parse(mapper.writeValueAsString(resource)).read("$.colleaguesMap.carter._links.user.href",
String.class), is(notNullValue()));
String.class)).isNotNull();
}
}

View File

@@ -48,7 +48,7 @@ import org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaCon
import org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaConverterUnitTests.TestConfiguration;
import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -59,7 +59,7 @@ import com.jayway.jsonpath.PathNotFoundException;
* @author Oliver Gierke
* @author Greg Turnquist
*/
@RunWith(SpringJUnit4ClassRunner.class)
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = { MongoDbRepositoryConfig.class, TestConfiguration.class })
public class PersistentEntityToJsonSchemaConverterUnitTests {