@@ -20,29 +20,26 @@ import static org.assertj.core.api.Assertions.*;
|
||||
import example.springdata.mongodb.Customer;
|
||||
import example.springdata.mongodb.QCustomer;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class CustomerRepositoryTests {
|
||||
@DataMongoTest
|
||||
class CustomerRepositoryTests {
|
||||
|
||||
@Autowired CustomerQuerydslRepository repository;
|
||||
@Autowired MongoOperations operations;
|
||||
|
||||
Customer dave, oliver, carter;
|
||||
private Customer dave, oliver, carter;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
repository.deleteAll();
|
||||
|
||||
@@ -52,7 +49,7 @@ public class CustomerRepositoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllByPredicate() {
|
||||
void findAllByPredicate() {
|
||||
assertThat(repository.findAll(QCustomer.customer.lastname.eq("Matthews"))).containsExactlyInAnyOrder(dave, oliver);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,33 +19,30 @@ import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import example.springdata.mongodb.Customer;
|
||||
import example.springdata.mongodb.QCustomer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class ReactiveCustomerRepositoryTests {
|
||||
@DataMongoTest
|
||||
class ReactiveCustomerRepositoryTests {
|
||||
|
||||
@Autowired ReactiveCustomerQuerydslRepository repository;
|
||||
@Autowired MongoOperations operations;
|
||||
|
||||
Customer dave, oliver, carter;
|
||||
private Customer dave, oliver, carter;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
repository.deleteAll().as(StepVerifier::create).verifyComplete();
|
||||
|
||||
@@ -57,7 +54,7 @@ public class ReactiveCustomerRepositoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllByPredicate() {
|
||||
void findAllByPredicate() {
|
||||
|
||||
repository.findAll(QCustomer.customer.lastname.eq("Matthews")) //
|
||||
.collectList() //
|
||||
|
||||
Reference in New Issue
Block a user