Read this when writing or modifying tests. See CLAUDE.md for the always-loaded safe command.
| Aspect | Detail |
|---|---|
| Test framework | JUnit Jupiter 5 (useJUnitPlatform() in build.gradle) |
| Mocking | Mockito 4 (mockito-core) |
| HTTP | OkHttp MockWebServer — real HTTP against a local mock server, not stubbed clients |
| Assertions | Hamcrest matchers |
| Location | src/test/java/com/auth0/ mirrors the src/main package layout |
| Fixtures | src/test/resources/ — wire-tests/, auth/ |
- Most Management API tests are Fern-generated (they carry the auto-generated header and live under the generated
mgmttree). Do not hand-edit them; behavioral test changes come from the spec/generator. - Hand-maintained tests are the ones listed in
.fernignore, e.g.:src/test/java/com/auth0/client/mgmt/ManagementApiBuilderTest.javasrc/test/java/com/auth0/client/mgmt/DynamicTokenManagementTest.javasrc/test/java/com/auth0/client/mgmt/OAuthTokenSupplierTest.javasrc/test/java/com/auth0/client/mgmt/CustomDomainInterceptorTest.javasrc/test/java/com/auth0/client/mgmt/CustomDomainHeaderIntegrationTest.java- the entire
src/test/java/com/auth0/client/auth/tree (Authentication API)
- Shared test infrastructure — also hand-maintained (
.fernignore):MockServer,RecordedRequestMatcher,UrlMatcher(undercom/auth0/client/) andAssertsUtil. Reuse these rather than rolling new HTTP-assertion helpers.
- New functionality in hand-maintained code (Authentication API, builders, token providers, interceptors) must ship with tests in the corresponding
.fernignore-listed location so Fern regeneration doesn't clobber them. - Tests must run with no network access and no real Auth0 tenant — use
MockWebServer/MockServerand fixture files undersrc/test/resources/. - Never put a real tenant domain, client secret, or token into a test or fixture.
Coverage is uploaded to Codecov under the unittests flag (.codecov.yml); HTML/XML reports are written to build/reports/ and uploaded as the Reports artifact in CI.