DATAMONGO-1677 - Polishing.

Switch tests to JUnit Jupiter.

Original Pull Request: #849
This commit is contained in:
Christoph Strobl
2020-04-06 08:28:17 +02:00
parent 28510de6c8
commit 5dd91d0b6d
4 changed files with 151 additions and 152 deletions

View File

@@ -395,9 +395,10 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query
@Query(value = "{_id:?0}")
Optional<org.bson.Document> findDocumentById(String id);
@Query(
value = "{ 'firstname' : ?0, 'lastname' : ?1, 'email' : ?2 , 'age' : ?3, 'sex' : ?4, 'createdAt' : ?5, 'skills' : ?6, 'address.street' : ?7, 'address.zipCode' : ?8, 'address.city' : ?9, 'uniqueId' : ?10, 'credentials.username' : ?11, 'credentials.password' : ?12 }")
@Query(value = "{ 'firstname' : ?0, 'lastname' : ?1, 'email' : ?2 , 'age' : ?3, 'sex' : ?4, "
+ "'createdAt' : ?5, 'skills' : ?6, 'address.street' : ?7, 'address.zipCode' : ?8, " //
+ "'address.city' : ?9, 'uniqueId' : ?10, 'credentials.username' : ?11, 'credentials.password' : ?12 }")
Person findPersonByManyArguments(String firstname, String lastname, String email, Integer age, Sex sex,
Date createdAt, List<String> skills, String street, String zipCode, String city, UUID uniqueId, String username,
String password);
Date createdAt, List<String> skills, String street, String zipCode, //
String city, UUID uniqueId, String username, String password);
}

View File

@@ -19,8 +19,7 @@ import static org.assertj.core.api.Assertions.*;
import java.util.List;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -31,12 +30,12 @@ import org.springframework.test.context.ContextConfiguration;
* @author Mark Paluch
*/
@ContextConfiguration("config/MongoNamespaceIntegrationTests-context.xml")
public class RedeclaringRepositoryMethodsTests extends AbstractPersonRepositoryIntegrationTests {
class RedeclaringRepositoryMethodsTests extends AbstractPersonRepositoryIntegrationTests {
@Autowired RedeclaringRepositoryMethodsRepository repository;
@Test // DATAMONGO-760
public void adjustedWellKnownPagedFindAllMethodShouldReturnOnlyTheUserWithFirstnameOliverAugust() {
void adjustedWellKnownPagedFindAllMethodShouldReturnOnlyTheUserWithFirstnameOliverAugust() {
Page<Person> page = repository.findAll(PageRequest.of(0, 2));
@@ -45,7 +44,7 @@ public class RedeclaringRepositoryMethodsTests extends AbstractPersonRepositoryI
}
@Test // DATAMONGO-760
public void adjustedWllKnownFindAllMethodShouldReturnAnEmptyList() {
void adjustedWllKnownFindAllMethodShouldReturnAnEmptyList() {
List<Person> result = repository.findAll();

View File

@@ -17,9 +17,8 @@ package org.springframework.data.mongodb.repository.config;
import static org.assertj.core.api.Assertions.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionReader;
@@ -40,14 +39,14 @@ import org.springframework.test.context.ContextConfiguration;
* @author Oliver Gierke
*/
@ContextConfiguration
public class MongoNamespaceIntegrationTests extends AbstractPersonRepositoryIntegrationTests {
class MongoNamespaceIntegrationTests extends AbstractPersonRepositoryIntegrationTests {
DefaultListableBeanFactory factory;
BeanDefinitionReader reader;
@Autowired ApplicationContext context;
@Before
@BeforeEach
@Override
public void setUp() throws InterruptedException {
super.setUp();
@@ -56,7 +55,7 @@ public class MongoNamespaceIntegrationTests extends AbstractPersonRepositoryInte
}
@Test
public void assertDefaultMappingContextIsWired() {
void assertDefaultMappingContextIsWired() {
reader.loadBeanDefinitions(new ClassPathResource("MongoNamespaceIntegrationTests-context.xml", getClass()));
BeanDefinition definition = factory.getBeanDefinition("personRepository");
@@ -64,7 +63,7 @@ public class MongoNamespaceIntegrationTests extends AbstractPersonRepositoryInte
}
@Test // DATAMONGO-581
public void exposesPersistentEntity() {
void exposesPersistentEntity() {
Repositories repositories = new Repositories(context);
PersistentEntity<?, ?> entity = repositories.getPersistentEntity(Person.class);