[BAEL-3913] Fixed broken lines format and reduced the test method names length
This commit is contained in:
parent
f1f9e87468
commit
adf1ee9b0d
|
@ -7,7 +7,8 @@ import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Profile("!test")
|
@Profile("!test")
|
||||||
@ConditionalOnProperty(prefix = "application.runner",
|
@ConditionalOnProperty(
|
||||||
|
prefix = "application.runner",
|
||||||
value = "enabled",
|
value = "enabled",
|
||||||
havingValue = "true",
|
havingValue = "true",
|
||||||
matchIfMissing = true)
|
matchIfMissing = true)
|
||||||
|
|
|
@ -6,7 +6,8 @@ import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Profile("!test")
|
@Profile("!test")
|
||||||
@ConditionalOnProperty(prefix = "command.line.runner",
|
@ConditionalOnProperty(
|
||||||
|
prefix = "command.line.runner",
|
||||||
value = "enabled",
|
value = "enabled",
|
||||||
havingValue = "true",
|
havingValue = "true",
|
||||||
matchIfMissing = true)
|
matchIfMissing = true)
|
||||||
|
|
|
@ -31,8 +31,7 @@ public class LoadSpringContextIntegrationTest {
|
||||||
ApplicationRunner applicationRunner;
|
ApplicationRunner applicationRunner;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenContextLoads_thenAllBeansAreLoadedButCommandLineAndApplicationRunnerAreNotExecuted()
|
void whenContextLoads_thenRunnersDoNotRun() throws Exception {
|
||||||
throws Exception {
|
|
||||||
assertNotNull(taskService);
|
assertNotNull(taskService);
|
||||||
assertNotNull(commandLineRunner);
|
assertNotNull(commandLineRunner);
|
||||||
assertNotNull(applicationRunner);
|
assertNotNull(applicationRunner);
|
||||||
|
|
|
@ -19,7 +19,7 @@ class RunApplicationIntegrationTest {
|
||||||
CommandLineTaskExecutor commandLineTaskExecutor;
|
CommandLineTaskExecutor commandLineTaskExecutor;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenContextLoads_thenTheCommandLineAndApplicationRunnerAreExecuted() throws Exception {
|
void whenContextLoads_thenRunnersRun() throws Exception {
|
||||||
verify(applicationRunnerTaskExecutor, times(1)).run(any());
|
verify(applicationRunnerTaskExecutor, times(1)).run(any());
|
||||||
verify(commandLineTaskExecutor, times(1)).run(any());
|
verify(commandLineTaskExecutor, times(1)).run(any());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RunApplicationWithTestProfileIntegrationTest {
|
||||||
private ApplicationContext context;
|
private ApplicationContext context;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenContextLoads_thenTheCommandLineAndApplicationRunnerAreNotLoaded() {
|
void whenContextLoads_thenRunnersAreNotLoaded() {
|
||||||
assertNotNull(context.getBean(TaskService.class));
|
assertNotNull(context.getBean(TaskService.class));
|
||||||
assertThrows(NoSuchBeanDefinitionException.class,
|
assertThrows(NoSuchBeanDefinitionException.class,
|
||||||
() -> context.getBean(CommandLineTaskExecutor.class),
|
() -> context.getBean(CommandLineTaskExecutor.class),
|
||||||
|
|
|
@ -12,17 +12,15 @@ import com.baeldung.prevent.commandline.application.runner.execution.Application
|
||||||
import com.baeldung.prevent.commandline.application.runner.execution.CommandLineTaskExecutor;
|
import com.baeldung.prevent.commandline.application.runner.execution.CommandLineTaskExecutor;
|
||||||
import com.baeldung.prevent.commandline.application.runner.execution.TaskService;
|
import com.baeldung.prevent.commandline.application.runner.execution.TaskService;
|
||||||
|
|
||||||
@SpringBootTest(
|
@SpringBootTest(properties = {
|
||||||
properties = {
|
|
||||||
"command.line.runner.enabled=false",
|
"command.line.runner.enabled=false",
|
||||||
"application.runner.enabled=false"
|
"application.runner.enabled=false" })
|
||||||
})
|
|
||||||
class RunApplicationWithTestPropertiesIntegrationTest {
|
class RunApplicationWithTestPropertiesIntegrationTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext context;
|
private ApplicationContext context;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenContextLoads_thenTheCommandLineAndApplicationRunnerAreNotLoaded() {
|
void whenContextLoads_thenRunnersAreNotLoaded() {
|
||||||
assertNotNull(context.getBean(TaskService.class));
|
assertNotNull(context.getBean(TaskService.class));
|
||||||
assertThrows(NoSuchBeanDefinitionException.class,
|
assertThrows(NoSuchBeanDefinitionException.class,
|
||||||
() -> context.getBean(CommandLineTaskExecutor.class),
|
() -> context.getBean(CommandLineTaskExecutor.class),
|
||||||
|
|
Loading…
Reference in New Issue