[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;
|
||||
|
||||
@Profile("!test")
|
||||
@ConditionalOnProperty(prefix = "application.runner",
|
||||
@ConditionalOnProperty(
|
||||
prefix = "application.runner",
|
||||
value = "enabled",
|
||||
havingValue = "true",
|
||||
matchIfMissing = true)
|
||||
|
@ -6,7 +6,8 @@ import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Profile("!test")
|
||||
@ConditionalOnProperty(prefix = "command.line.runner",
|
||||
@ConditionalOnProperty(
|
||||
prefix = "command.line.runner",
|
||||
value = "enabled",
|
||||
havingValue = "true",
|
||||
matchIfMissing = true)
|
||||
|
@ -31,8 +31,7 @@ public class LoadSpringContextIntegrationTest {
|
||||
ApplicationRunner applicationRunner;
|
||||
|
||||
@Test
|
||||
void whenContextLoads_thenAllBeansAreLoadedButCommandLineAndApplicationRunnerAreNotExecuted()
|
||||
throws Exception {
|
||||
void whenContextLoads_thenRunnersDoNotRun() throws Exception {
|
||||
assertNotNull(taskService);
|
||||
assertNotNull(commandLineRunner);
|
||||
assertNotNull(applicationRunner);
|
||||
|
@ -19,7 +19,7 @@ class RunApplicationIntegrationTest {
|
||||
CommandLineTaskExecutor commandLineTaskExecutor;
|
||||
|
||||
@Test
|
||||
void whenContextLoads_thenTheCommandLineAndApplicationRunnerAreExecuted() throws Exception {
|
||||
void whenContextLoads_thenRunnersRun() throws Exception {
|
||||
verify(applicationRunnerTaskExecutor, times(1)).run(any());
|
||||
verify(commandLineTaskExecutor, times(1)).run(any());
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class RunApplicationWithTestProfileIntegrationTest {
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
void whenContextLoads_thenTheCommandLineAndApplicationRunnerAreNotLoaded() {
|
||||
void whenContextLoads_thenRunnersAreNotLoaded() {
|
||||
assertNotNull(context.getBean(TaskService.class));
|
||||
assertThrows(NoSuchBeanDefinitionException.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.TaskService;
|
||||
|
||||
@SpringBootTest(
|
||||
properties = {
|
||||
@SpringBootTest(properties = {
|
||||
"command.line.runner.enabled=false",
|
||||
"application.runner.enabled=false"
|
||||
})
|
||||
"application.runner.enabled=false" })
|
||||
class RunApplicationWithTestPropertiesIntegrationTest {
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
void whenContextLoads_thenTheCommandLineAndApplicationRunnerAreNotLoaded() {
|
||||
void whenContextLoads_thenRunnersAreNotLoaded() {
|
||||
assertNotNull(context.getBean(TaskService.class));
|
||||
assertThrows(NoSuchBeanDefinitionException.class,
|
||||
() -> context.getBean(CommandLineTaskExecutor.class),
|
||||
|
Loading…
x
Reference in New Issue
Block a user