Formatting cleanup
This commit is contained in:
parent
759298a2bc
commit
02ba4a5605
|
@ -7,7 +7,6 @@ import org.junit.Before;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.mongodb.core.MongoOperations;
|
import org.springframework.data.mongodb.core.MongoOperations;
|
||||||
|
|
||||||
|
|
||||||
public class BaseQueryIntegrationTest {
|
public class BaseQueryIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -111,4 +111,3 @@ public class DSLQueryIntegrationTest extends BaseQueryIntegrationTest {
|
||||||
assertThat(users.size(), is(1));
|
assertThat(users.size(), is(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
@ContextConfiguration(classes = MongoConfig.class)
|
@ContextConfiguration(classes = MongoConfig.class)
|
||||||
public class JSONQueryIntegrationTest extends BaseQueryIntegrationTest {
|
public class JSONQueryIntegrationTest extends BaseQueryIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUsersExist_whenFindingUsersByName_thenUsersAreFound() {
|
public void givenUsersExist_whenFindingUsersByName_thenUsersAreFound() {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setName("Eric");
|
user.setName("Eric");
|
||||||
|
@ -31,69 +31,68 @@ public class JSONQueryIntegrationTest extends BaseQueryIntegrationTest {
|
||||||
assertThat(users.size(), is(1));
|
assertThat(users.size(), is(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUsersExist_whenFindingUsersWithAgeCreaterThanAndLessThan_thenUsersAreFound() {
|
public void givenUsersExist_whenFindingUsersWithAgeCreaterThanAndLessThan_thenUsersAreFound() {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setAge(20);
|
user.setAge(20);
|
||||||
user.setName("Jon");
|
user.setName("Jon");
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
user = new User();
|
user = new User();
|
||||||
user.setAge(50);
|
user.setAge(50);
|
||||||
user.setName("Jon");
|
user.setName("Jon");
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
user = new User();
|
user = new User();
|
||||||
user.setAge(33);
|
user.setAge(33);
|
||||||
user.setName("Jim");
|
user.setName("Jim");
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
List<User> users = userRepository.findUsersByAgeBetween(26, 40);
|
List<User> users = userRepository.findUsersByAgeBetween(26, 40);
|
||||||
assertThat(users.size(), is(1));
|
assertThat(users.size(), is(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUsersExist_whenFindingUserWithNameStartWithA_thenUsersAreFound() {
|
public void givenUsersExist_whenFindingUserWithNameStartWithA_thenUsersAreFound() {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setName("Eric");
|
user.setName("Eric");
|
||||||
user.setAge(45);
|
user.setAge(45);
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
user = new User();
|
user = new User();
|
||||||
user.setName("Antony");
|
user.setName("Antony");
|
||||||
user.setAge(33);
|
user.setAge(33);
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
user = new User();
|
user = new User();
|
||||||
user.setName("Alice");
|
user.setName("Alice");
|
||||||
user.setAge(35);
|
user.setAge(35);
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
List<User> users = userRepository.findUsersByRegexpName("^A");
|
List<User> users = userRepository.findUsersByRegexpName("^A");
|
||||||
|
|
||||||
assertThat(users.size(), is(2));
|
assertThat(users.size(), is(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenUsersExist_whenFindingUserWithNameEndWithC_thenUsersAreFound() {
|
public void givenUsersExist_whenFindingUserWithNameEndWithC_thenUsersAreFound() {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setName("Eric");
|
user.setName("Eric");
|
||||||
user.setAge(45);
|
user.setAge(45);
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
user = new User();
|
user = new User();
|
||||||
user.setName("Antony");
|
user.setName("Antony");
|
||||||
user.setAge(33);
|
user.setAge(33);
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
user = new User();
|
user = new User();
|
||||||
user.setName("Alice");
|
user.setName("Alice");
|
||||||
user.setAge(35);
|
user.setAge(35);
|
||||||
mongoOps.insert(user);
|
mongoOps.insert(user);
|
||||||
|
|
||||||
List<User> users = userRepository.findUsersByRegexpName("c$");
|
List<User> users = userRepository.findUsersByRegexpName("c$");
|
||||||
|
|
||||||
assertThat(users.size(), is(1));
|
assertThat(users.size(), is(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue