Alex Arana created CAMEL-15755:
----------------------------------

             Summary: Spring Boot tests broken when using 
TestInstance.Lifecycle.PER_CLASS
                 Key: CAMEL-15755
                 URL: https://issues.apache.org/jira/browse/CAMEL-15755
             Project: Camel
          Issue Type: Bug
          Components: camel-spring, camel-test, tests
    Affects Versions: 3.6.0
            Reporter: Alex Arana


After upgrading to {{3.6.0}} existing Spring Boot tests in my codebase started 
to fail. After some investigation I discovered that this is due to my unit 
tests having a single instance per class as configured using JUnit's 

@TestInstance(TestInstance.Lifecycle.PER_CLASS)

Some changes were introduced in a recent commit that affected the existing 
behaviour in CamelSpringBootExecutionListener: 
[efc34ab2b98|[https://github.com/apache/camel/commit/efc34ab2b98f3697ebb482cf1645fda6f0794797].]

I have remediated my tests by running the following code in a JUnit BeforeEach 
method within a base test class:
{code:java}
// Kotlin
@BeforeEach
fun init() {
    SpringCamelContext.setNoStart(false)
    camelContext.start()
}
{code}
I am currently looking for a more permanent solution to this issue that 
properly supports single instance JUnit5 Test classes.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to