This commit is contained in:
parent
e8b2ea9a92
commit
b689e22bcf
|
@ -10,7 +10,7 @@ import static org.junit.Assert.assertNotNull;
|
|||
|
||||
/**
|
||||
* @SpringJUnitConfig(SpringJUnitConfigTest.Config.class) is equivalent to:
|
||||
*
|
||||
*
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @ContextConfiguration(classes = SpringJUnitConfigTest.Config.class )
|
||||
*
|
||||
|
@ -18,10 +18,6 @@ import static org.junit.Assert.assertNotNull;
|
|||
@SpringJUnitConfig(SpringJUnitConfigIntegrationTest.Config.class)
|
||||
public class SpringJUnitConfigIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
static class Config {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
|
@ -30,4 +26,8 @@ public class SpringJUnitConfigIntegrationTest {
|
|||
assertNotNull(applicationContext);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class Config {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package com.baeldung.springjunitconfiguration;
|
||||
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringJUnitConfig(classes = TestConfig.class , loader = AnnotationConfigContextLoader.class)
|
||||
@SpringJUnitConfig(classes = TestConfig.class, loader = AnnotationConfigContextLoader.class)
|
||||
public class SpringJUnitConfigurationParameterizedTest {
|
||||
|
||||
@ParameterizedTest
|
||||
|
|
|
@ -10,7 +10,7 @@ import static org.junit.Assert.assertNotNull;
|
|||
|
||||
/**
|
||||
* @SpringJUnitWebConfig(SpringJUnitWebConfigTest.Config.class) is equivalent to:
|
||||
*
|
||||
*
|
||||
* @ExtendWith(SpringExtension.class)
|
||||
* @WebAppConfiguration
|
||||
* @ContextConfiguration(classes = SpringJUnitWebConfigTest.Config.class )
|
||||
|
@ -19,10 +19,6 @@ import static org.junit.Assert.assertNotNull;
|
|||
@SpringJUnitWebConfig(SpringJUnitWebConfigIntegrationTest.Config.class)
|
||||
public class SpringJUnitWebConfigIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
static class Config {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private WebApplicationContext webAppContext;
|
||||
|
||||
|
@ -31,4 +27,8 @@ public class SpringJUnitWebConfigIntegrationTest {
|
|||
assertNotNull(webAppContext);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class Config {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.baeldung.springjunitconfiguration;
|
|||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
public class TestConfig {
|
||||
|
||||
|
|
Loading…
Reference in New Issue