Merge pull request #6609 from eugenp/BAEL-10897-v

fix multiple sql files test
This commit is contained in:
Loredana Crusoveanu 2019-03-29 23:53:36 +02:00 committed by GitHub
commit c69b0d7552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1 @@
spring.jpa.properties.hibernate.hbm2ddl.import_files=import_active_users.sql,import_inactive_users.sql