I’m doing the Wizards and Warriors exercise, working locally on Linux.
When I do ./gradlew test, it always passes the tests (so long as the code actually compiles), but I’m able to change the code to return garbage values that should fail the test – but gradle still says it’s okay.
If I paste the bad code into the online editor, the tests fail or succeed as expected.
I saw some documentation about skipping tests, but clicking around I didn’t find anything specifically about how the Java tests work.
How do I get the local Java tests to run and work?
How do I define my own tests? I’ve worked in the Racket track and there it’s easy to add your own tests.
Actually, looking at this further: it doesn’t seem like there are any tests for this exercise! The Java “log level” exercise has tests defined in src/test/java but there’s no such directory for the wizards and warriors one. Is that a bug or misconfiguration for the exercise?
You can find the test file under src/test/java. When you first get the files, all the tests except the first one will have @Disabled("Remove to run test"). You need to remove that to enable additional tests. You can also add tests to that file.
Wizards and Warriors is a concept exercise, not a practice exercise. Those tend to be configured a bit different. That said, I think there should be a src/test/java directory. How did you download things? Are you in the download directory?