Skip to content

Trouble Testing in Spring Shell 2 #171

@jgreub

Description

@jgreub

Hey, I just stumbled upon Spring Shell recently and I am unable to get a @SpringBootTest test to execute. The test attempts to begin, but hangs in the IntelliJ console as if a shell has been created and waiting for input.

Test:

@RunWith(SpringRunner.class)
@SpringBootTest
public class RecordScoreTest {

    @Test
    public void simpleTest() {
        Assertions.assertThat(true).isTrue();
    }
}

Console:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.8.RELEASE)

2017-10-22 07:56:01.498  INFO 11233 --- [           main] c.j.bowlinggamekata.RecordScoreTest      : Starting RecordScoreTest on JoeMacPro.local with PID 11233 (started by joe in /Users/joe/workspace/bowling-game-kata)
2017-10-22 07:56:01.500  INFO 11233 --- [           main] c.j.bowlinggamekata.RecordScoreTest      : No active profile set, falling back to default profiles: default
2017-10-22 07:56:01.534  INFO 11233 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@5fbe4146: startup date [Sun Oct 22 07:56:01 PDT 2017]; root of context hierarchy
2017-10-22 07:56:02.043  INFO 11233 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.shell.SpringShellAutoConfiguration' of type [org.springframework.shell.SpringShellAutoConfiguration$$EnhancerBySpringCGLIB$$f25f3e65] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-22 07:56:02.062  INFO 11233 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'conversionService' of type [org.springframework.core.convert.support.DefaultConversionService] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-22 07:56:02.437  WARN 11233 --- [           main] org.jline                                : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)

Here's a link to my tiny repo that acts as the simplest way to reproduce this issue: https://github.com/jgreub/bowling-game-kata
I'm trying to use Spring Shell 2.0.0.M2 with Spring Boot 1.5.8.RELEASE


As a follow up

When it comes to actually testing a @ShellMethod, this stackoverflow post claims you use the Shell#evaluate() method. How do you obtain an instance of Shell in a test?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions