BAEL-1924 (#4573)
* BAEL-1412 add java 8 spring data features * BAEL-21 new HTTP API overview * BAEL-21 fix executor * BAEL-1432 add custom gradle task * BAEL-1567 add samples of cookie and session in serlvet * BAEL-1567 use stream api * BAEL-1567 fix optional * BAEL-1679 add query annotation jpa spring data * BAEL-1679 added new junits * BAEL-1679 use assertJ, use givenWhenThen naming convention * BAEL-1679 move query annotation examples to persistence modules * BAEL-1679 fix formatting * BAEL-659 add junits for repositories * BAEL-659 add one junit * BAEL-659 remove one duplicated dependency * BAEL-659 fix test class name * BAEL-1924 add import many files
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package org.baeldung.boot.repository;
|
||||
|
||||
import org.baeldung.boot.domain.User;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Created by adam.
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataJpaTest
|
||||
public class UserRepositoryDataJpaIntegrationTest {
|
||||
|
||||
@Autowired private UserRepository userRepository;
|
||||
|
||||
@Test
|
||||
public void givenTwoImportFilesWhenFindAllShouldReturnSixUsers() {
|
||||
Collection<User> users = userRepository.findAll();
|
||||
|
||||
assertThat(users.size()).isEqualTo(6);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.baeldung.repository;
|
||||
package org.baeldung.boot.repository;
|
||||
|
||||
import org.baeldung.boot.config.H2JpaConfig;
|
||||
import org.baeldung.model.User;
|
||||
import org.baeldung.boot.domain.User;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -27,8 +27,7 @@ public class UserRepositoryIntegrationTest {
|
||||
private final String USER_NAME_ADAM = "Adam";
|
||||
private final Integer ACTIVE_STATUS = 1;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
@Autowired private UserRepository userRepository;
|
||||
|
||||
@Test
|
||||
public void givenEmptyDBWhenFindOneByNameThenReturnEmptyOptional() {
|
||||
Reference in New Issue
Block a user