michaelin007 2023-12-21 09:48:02 +00:00
parent e8b2ea9a92
commit b689e22bcf
4 changed files with 13 additions and 15 deletions

View File

@ -18,10 +18,6 @@ import static org.junit.Assert.assertNotNull;
@SpringJUnitConfig(SpringJUnitConfigIntegrationTest.Config.class) @SpringJUnitConfig(SpringJUnitConfigIntegrationTest.Config.class)
public class SpringJUnitConfigIntegrationTest { public class SpringJUnitConfigIntegrationTest {
@Configuration
static class Config {
}
@Autowired @Autowired
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@ -30,4 +26,8 @@ public class SpringJUnitConfigIntegrationTest {
assertNotNull(applicationContext); assertNotNull(applicationContext);
} }
@Configuration
static class Config {
}
} }

View File

@ -1,15 +1,13 @@
package com.baeldung.springjunitconfiguration; package com.baeldung.springjunitconfiguration;
import java.util.List;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.springframework.beans.factory.annotation.Autowired; 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.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.support.AnnotationConfigContextLoader; 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 { public class SpringJUnitConfigurationParameterizedTest {
@ParameterizedTest @ParameterizedTest

View File

@ -19,10 +19,6 @@ import static org.junit.Assert.assertNotNull;
@SpringJUnitWebConfig(SpringJUnitWebConfigIntegrationTest.Config.class) @SpringJUnitWebConfig(SpringJUnitWebConfigIntegrationTest.Config.class)
public class SpringJUnitWebConfigIntegrationTest { public class SpringJUnitWebConfigIntegrationTest {
@Configuration
static class Config {
}
@Autowired @Autowired
private WebApplicationContext webAppContext; private WebApplicationContext webAppContext;
@ -31,4 +27,8 @@ public class SpringJUnitWebConfigIntegrationTest {
assertNotNull(webAppContext); assertNotNull(webAppContext);
} }
@Configuration
static class Config {
}
} }

View File

@ -2,7 +2,7 @@ package com.baeldung.springjunitconfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@Configuration @Configuration
public class TestConfig { public class TestConfig {