Spring Zeebe Testcontainers not working

Hi all,

I’m using Spring Boot and therefore Spring Zeebe Client, all on Java 8. According to the readme file of Spring Zeebe, I have to use Testcontainers (due to my Java version). However, although I added the respective dependency to my pom.xml and I can see Testcontainers’s jar under “external libraries”, IntelliJ’s autocomplete feature won’t find anything related to Testcontainers: no @Testcontainers annotation, no @Container annotation, nothing. Although this might be related to IntellJ, I severely doubt that it actually is - more likely, something with my setup is wrong. Unfortunately, there is little to no documentation / examples on how to use Spring Zeebe’s Testcontainer (which hat least has its own dependency), so I could not figure it out myself.

Here’s a part of my pom.xml:

<dependency>
            <groupId>io.camunda</groupId>
            <artifactId>spring-zeebe-test-testcontainer</artifactId>
            <version>${spring.zeebe.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.5.4</version>
            <scope>test</scope>
        </dependency>

Just let me know if more code snippets or something are needed.

Hi @codeHarder,

there is some context around this in the zeebe-process-test repository: GitHub - camunda/zeebe-process-test: Testing project for Camunda Cloud and GitHub - camunda/zeebe-process-test: Testing project for Camunda Cloud.

Hope this helps, Ingo

Thanks @Ingo_Richtsmeier, this kind of helps indeed. I had assumed that I could not necessarily transfer “plain” Zeebe testcontainer functionality on Spring Zeebe testcontainer, so it’s good to know I actually can :wink: I’ll take a look at my setup with this background and see if I can fix my problem.

OK, after I returned from my holidays I tried setting up Zeebe Process Test as described in the links above. Given the following code:

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.response.DeploymentEvent;
import io.camunda.zeebe.process.test.api.ZeebeTestEngine;
import io.camunda.zeebe.process.test.assertions.BpmnAssert;
import io.camunda.zeebe.process.test.assertions.DeploymentAssert;
import io.camunda.zeebe.process.test.extension.testcontainer.ZeebeProcessTest;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

@ZeebeProcessTest
@SpringBootTest
public class TestIT {

    private ZeebeClient client;
    private ZeebeTestEngine engine;

    @Test
    public void isDiagramDeployable() {
        DeploymentEvent event = this.client.newDeployResourceCommand()
                .addResourceFromClasspath("ADS.bpmn")
                .send()
                .join();
        DeploymentAssert assertion = BpmnAssert.assertThat(event);
    }
}

I get a NullPointerException at line 19 because client is null and has therefore not been injected. If I use @ZeebeSpringTest instead of @ZeebeProcessTest, I get

io/camunda/zeebe/spring/test/ZeebeTestClientSpringConfiguration has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

In both cases, the dependency is the same as above (spring-zeebe-test-testcontainer), because everything still has to be merged into the Spring lifecycle somehow, ae least to my understanding.