#Cucumber simple test

1 messages · Page 1 of 1 (latest)

visual otter
#
@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/features",
        glue = "org.example",
        plugin = {"pretty"},
        snippets = SnippetType.CAMELCASE
)
public class CucumberRunnerTest {
}
import static org.junit.jupiter.api.Assertions.assertEquals;

public class StepDefinitions {
    private int result;

    @Given("a calculator")
    public void aCalculator() {
        result = 0; // Initialize calculator
    }

    @When("I add (\\d+) and (\\d+)")
    public void iAddAnd(int a, int b) {
        result = a + b; // Perform addition
    }

    @Then("the result should be (\\d+)")
    public void theResultShouldBe(int expectedResult) {
        assertEquals(expectedResult, result); // Verify result
    }
}
Feature: Basic arithmetic

  Scenario: Addition
    Given a calculator
    When I add 2 and 3
    Then the result should be 5

Gives me this error: Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @59f95c5d

balmy krakenBOT
#

<@&987246399047479336> please have a look, thanks.

visual otter
#

I cannot find solution in Google

tender rapids
#

And if you add --add-opens java.base/java.util=ALL-UNNAMED?

visual otter