Merge pull request #6609 from eugenp/BAEL-10897-v
fix multiple sql files test
This commit is contained in:
commit
c69b0d7552
|
@ -4,6 +4,7 @@ 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.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.boot.domain.User;
|
||||
|
@ -18,7 +19,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataJpaTest
|
||||
public class UserRepositoryIntegrationTest {
|
||||
@ActiveProfiles("multiplesqlfiles")
|
||||
public class UserRepositoryMultipleSqlFilesIntTest {
|
||||
|
||||
@Autowired private UserRepository userRepository;
|
||||
|
||||
|
@ -26,7 +28,7 @@ public class UserRepositoryIntegrationTest {
|
|||
public void givenTwoImportFilesWhenFindAllShouldReturnSixUsers() {
|
||||
Collection<User> users = userRepository.findAll();
|
||||
|
||||
assertThat(users.size()).isEqualTo(3);
|
||||
assertThat(users.size()).isEqualTo(6);
|
||||
}
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ public class UserRepositoryIntegrationTest {
|
|||
userRepository.save(new User("Bob", "bob@domain.com"));
|
||||
List<User> users = (List<User>) userRepository.findAll();
|
||||
|
||||
// 2 additional users are saved in the CommandLineRunner bean
|
||||
assertThat(users.size()).isEqualTo(3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
spring.jpa.properties.hibernate.hbm2ddl.import_files=import_active_users.sql,import_inactive_users.sql
|
Loading…
Reference in New Issue