Skip to content

Commit b8f5459

Browse files
committedJul 10, 2022
refactor: simplify tests configuration by passing properties directly to @jdbcTest
1 parent c7dc4b1 commit b8f5459

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed
 

‎src/test/java/ru/mystamps/web/feature/category/JdbcCategoryDaoTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,22 @@
2323
import org.springframework.beans.factory.annotation.Autowired;
2424
import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest;
2525
import org.springframework.test.context.ContextConfiguration;
26-
import org.springframework.test.context.TestPropertySource;
2726
import org.springframework.test.context.jdbc.Sql;
2827
import org.springframework.test.context.junit.jupiter.SpringExtension;
2928
import ru.mystamps.web.config.DaoConfig;
3029
import ru.mystamps.web.tests.Random;
3130

3231
import java.util.Map;
3332

34-
@JdbcTest
35-
@ContextConfiguration(classes = DaoConfig.class)
36-
@TestPropertySource(
33+
@JdbcTest(
3734
properties = {
3835
// don't load test data, start with an empty database
3936
"spring.liquibase.contexts=scheme,init-data",
4037
// overrides settings from application-test.properties to keep the console clean,
4138
// comment this out when you need to debug tests. See also logback-test.xml
4239
"logging.level.root=WARN", "logging.level.ru.mystamps=WARN"
4340
})
41+
@ContextConfiguration(classes = DaoConfig.class)
4442
@ExtendWith(SpringExtension.class)
4543
public class JdbcCategoryDaoTest implements WithAssertions {
4644

‎src/test/java/ru/mystamps/web/feature/country/JdbcCountryDaoTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,22 @@
2323
import org.springframework.beans.factory.annotation.Autowired;
2424
import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest;
2525
import org.springframework.test.context.ContextConfiguration;
26-
import org.springframework.test.context.TestPropertySource;
2726
import org.springframework.test.context.jdbc.Sql;
2827
import org.springframework.test.context.junit.jupiter.SpringExtension;
2928
import ru.mystamps.web.config.DaoConfig;
3029
import ru.mystamps.web.tests.Random;
3130

3231
import java.util.Map;
3332

34-
@JdbcTest
35-
@ContextConfiguration(classes = DaoConfig.class)
36-
@TestPropertySource(
33+
@JdbcTest(
3734
properties = {
3835
// don't load test data, start with an empty database
3936
"spring.liquibase.contexts=scheme,init-data",
4037
// overrides settings from application-test.properties to keep the console clean,
4138
// comment this out when you need to debug tests. See also logback-test.xml
4239
"logging.level.root=WARN", "logging.level.ru.mystamps=WARN"
4340
})
41+
@ContextConfiguration(classes = DaoConfig.class)
4442
@ExtendWith(SpringExtension.class)
4543
public class JdbcCountryDaoTest implements WithAssertions {
4644

0 commit comments

Comments
 (0)
Please sign in to comment.