[JAVA-8355] Move article code to spring-testing-2 module

This commit is contained in:
Haroon Khan 2021-11-25 19:51:32 +00:00
parent be86acb87f
commit 805500140f
7 changed files with 11 additions and 8 deletions

View File

@ -3,3 +3,4 @@
- [Guide to @DynamicPropertySource in Spring](https://www.baeldung.com/spring-dynamicpropertysource) - [Guide to @DynamicPropertySource in Spring](https://www.baeldung.com/spring-dynamicpropertysource)
- [Concurrent Test Execution in Spring 5](https://www.baeldung.com/spring-5-concurrent-tests) - [Concurrent Test Execution in Spring 5](https://www.baeldung.com/spring-5-concurrent-tests)
- [Spring 5 Testing with @EnabledIf Annotation](https://www.baeldung.com/spring-5-enabledIf) - [Spring 5 Testing with @EnabledIf Annotation](https://www.baeldung.com/spring-5-enabledIf)
- [The Spring TestExecutionListener](https://www.baeldung.com/spring-testexecutionlistener)

View File

@ -1,7 +1,5 @@
package com.baeldung.testexecutionlisteners; package com.baeldung.testexecutionlisteners;
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -9,9 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration(classes = AdditionService.class) @ContextConfiguration(classes = AdditionService.class)
public class AdditionServiceUnitTest { public class AdditionServiceUnitTest {
@Autowired @Autowired
private AdditionService additionService; private AdditionService additionService;

View File

@ -1,7 +1,5 @@
package com.baeldung.testexecutionlisteners; package com.baeldung.testexecutionlisteners;
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -11,11 +9,14 @@ import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.TestExecutionListeners.MergeMode; import org.springframework.test.context.TestExecutionListeners.MergeMode;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@TestExecutionListeners(value = { CustomTestExecutionListener.class }, @TestExecutionListeners(value = { CustomTestExecutionListener.class },
mergeMode = MergeMode.MERGE_WITH_DEFAULTS) mergeMode = MergeMode.MERGE_WITH_DEFAULTS)
@ContextConfiguration(classes = AdditionService.class) @ContextConfiguration(classes = AdditionService.class)
public class TestExecutionListenersWithMergeModeUnitTest { public class TestExecutionListenersWithMergeModeUnitTest {
@Autowired @Autowired
private AdditionService additionService; private AdditionService additionService;

View File

@ -1,7 +1,5 @@
package com.baeldung.testexecutionlisteners; package com.baeldung.testexecutionlisteners;
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -11,11 +9,14 @@ import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@TestExecutionListeners(value = {CustomTestExecutionListener.class, @TestExecutionListeners(value = {CustomTestExecutionListener.class,
DependencyInjectionTestExecutionListener.class}) DependencyInjectionTestExecutionListener.class})
@ContextConfiguration(classes = AdditionService.class) @ContextConfiguration(classes = AdditionService.class)
public class TestExecutionListenersWithoutMergeModeUnitTest { public class TestExecutionListenersWithoutMergeModeUnitTest {
@Autowired @Autowired
private AdditionService additionService; private AdditionService additionService;

View File

@ -7,4 +7,3 @@
- [Using SpringJUnit4ClassRunner with Parameterized](https://www.baeldung.com/springjunit4classrunner-parameterized) - [Using SpringJUnit4ClassRunner with Parameterized](https://www.baeldung.com/springjunit4classrunner-parameterized)
- [Override Properties in Springs Tests](https://www.baeldung.com/spring-tests-override-properties) - [Override Properties in Springs Tests](https://www.baeldung.com/spring-tests-override-properties)
- [A Quick Guide to @DirtiesContext](https://www.baeldung.com/spring-dirtiescontext) - [A Quick Guide to @DirtiesContext](https://www.baeldung.com/spring-dirtiescontext)
- [The Spring TestExecutionListener](https://www.baeldung.com/spring-testexecutionlistener)