Skip to content

Commit 9cb9838

Browse files
authored
[JAVA-40681] Move code between spring-testing and spring-testing-2 modules (#18221)
1 parent 0d920b0 commit 9cb9838

28 files changed

+57
-7
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
## Relevant Articles:
2-
3-
- [Guide to @DynamicPropertySource in Spring](https://www.baeldung.com/spring-dynamicpropertysource)
42
- [Concurrent Test Execution in Spring](https://www.baeldung.com/spring-5-concurrent-tests)
53
- [Spring Testing with @EnabledIf Annotation](https://www.baeldung.com/spring-5-enabledif)
64
- [The Spring TestExecutionListener](https://www.baeldung.com/spring-testexecutionlistener)
7-
- [Execute Tests Based on Active Profile With JUnit 5](https://www.baeldung.com/spring-boot-junit-5-testing-active-profile)
85
- [A Guide to @‌MockBeans](https://www.baeldung.com/java-spring-mockbeans)
96
- [Mock @Value in Spring Boot Test](https://www.baeldung.com/java-spring-boot-test-mock-value)
7+
- [How to Test the @Scheduled Annotation](https://www.baeldung.com/spring-testing-scheduled-annotation)
8+
- [Using SpringJUnit4ClassRunner with Parameterized](https://www.baeldung.com/springjunit4classrunner-parameterized)

testing-modules/spring-testing-2/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
<version>${testcontainers.version}</version>
4040
<scope>test</scope>
4141
</dependency>
42+
<dependency>
43+
<groupId>org.awaitility</groupId>
44+
<artifactId>awaitility</artifactId>
45+
<scope>test</scope>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.junit.jupiter</groupId>
49+
<artifactId>junit-jupiter</artifactId>
50+
<scope>test</scope>
51+
</dependency>
4252
<dependency>
4353
<groupId>org.testcontainers</groupId>
4454
<artifactId>junit-jupiter</artifactId>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.baeldung.config;
2+
3+
import org.springframework.context.annotation.ComponentScan;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.scheduling.annotation.EnableScheduling;
6+
7+
@Configuration
8+
@EnableScheduling
9+
@ComponentScan("com.baeldung.scheduled")
10+
public class ScheduledConfig {
11+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.baeldung.config;
2+
3+
import javax.servlet.ServletContext;
4+
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.context.annotation.ComponentScan;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
9+
10+
@EnableWebMvc
11+
@Configuration
12+
@ComponentScan(basePackages = {"com.baeldung.controller.parameterized"})
13+
public class WebConfig {
14+
15+
@Autowired
16+
private ServletContext ctx;
17+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.baeldung.scheduled;
22

33
import com.baeldung.config.ScheduledConfig;
4-
import org.awaitility.Duration;
4+
import org.awaitility.Durations;
55
import org.junit.jupiter.api.Test;
66
import org.springframework.boot.test.mock.mockito.SpyBean;
77
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
@@ -18,7 +18,7 @@ public class ScheduledAwaitilityIntegrationTest {
1818
@Test
1919
public void whenWaitOneSecond_thenScheduledIsCalledAtLeastTenTimes() {
2020
await()
21-
.atMost(Duration.ONE_SECOND)
21+
.atMost(Durations.ONE_SECOND)
2222
.untilAsserted(() -> verify(counter, atLeast(10)).scheduled());
2323
}
2424
}

0 commit comments

Comments
 (0)