microcks / microcks-testcontainers-java

Java lib for Testcontainers that enables embedding Microcks into your JUnit tests with lightweight, throwaway instance thanks to containers.
https://microcks.io
Apache License 2.0
19 stars 4 forks source link

Make TestRequest.Builder more fluent #38

Closed lbroudoux closed 7 months ago

lbroudoux commented 7 months ago

Reason/Context

As of today, we only have basic types as signature within the TestRequest.Builder utility:

Those are not very readable and we have to describe things like this:

TestRequest otherTestRequestDTO = new TestRequest.Builder()
            .serviceId("Pastry orders API:0.1.0")
            .runnerType(TestRunnerType.ASYNC_API_SCHEMA.name())
            .testEndpoint("kafka://kafka:19092/pastry-orders")
            .timeout(3000L)
            .build();

Description

It would be nice to be able to support explicit types like Duration and enumeration like TestRunnerType. That way, we will be able to write things like:

TestRequest otherTestRequestDTO = new TestRequest.Builder()
            .serviceId("Pastry orders API:0.1.0")
            .runnerType(TestRunnerType.ASYNC_API_SCHEMA)
            .testEndpoint("kafka://kafka:19092/pastry-orders")
            .timeout(Duration.ofSeconds(3))
            .build();

Implementation ideas

No response