Merge pull request #11513 from hkhan/JAVA-8355-split-spring-testing

[JAVA-8355] Move article code to spring-testing-2 module
This commit is contained in:
kwoyke 2021-11-26 09:50:00 +01:00 committed by GitHub
commit 78801db51c
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)
- [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)
- [The Spring TestExecutionListener](https://www.baeldung.com/spring-testexecutionlistener)

View File

@ -1,7 +1,5 @@
package com.baeldung.testexecutionlisteners;
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers;
import org.junit.Test;
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.junit4.SpringRunner;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = AdditionService.class)
public class AdditionServiceUnitTest {
@Autowired
private AdditionService additionService;

View File

@ -1,7 +1,5 @@
package com.baeldung.testexecutionlisteners;
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers;
import org.junit.Test;
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.junit4.SpringRunner;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(SpringRunner.class)
@TestExecutionListeners(value = { CustomTestExecutionListener.class },
@TestExecutionListeners(value = { CustomTestExecutionListener.class },
mergeMode = MergeMode.MERGE_WITH_DEFAULTS)
@ContextConfiguration(classes = AdditionService.class)
public class TestExecutionListenersWithMergeModeUnitTest {
@Autowired
private AdditionService additionService;

View File

@ -1,7 +1,5 @@
package com.baeldung.testexecutionlisteners;
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers;
import org.junit.Test;
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.support.DependencyInjectionTestExecutionListener;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(SpringRunner.class)
@TestExecutionListeners(value = {CustomTestExecutionListener.class,
DependencyInjectionTestExecutionListener.class})
@ContextConfiguration(classes = AdditionService.class)
public class TestExecutionListenersWithoutMergeModeUnitTest {
@Autowired
private AdditionService additionService;

View File

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