1.5 KiB
1.5 KiB
name, description
| name | description |
|---|---|
| java-testing | Use when adding or changing unit or integration tests for Java services, validation, project keys, or HTTP interactions. |
Java testing
- Use pinned JUnit Jupiter and AssertJ; use Mockito only for narrow collaborator seams.
- Mock HTTP at the transport boundary with a local in-process
HttpServer; tests must not need a real Gitea instance or network. - Test pagination, authentication failures, 404, 5xx, malformed payloads, timeout behavior, and secret redaction.
- Test project-key sanitization, invalid/empty inputs, and collisions across distinct source names.
- Test organization allowlist behavior in both fixed and all-accessible modes.
- Use deterministic fixtures, no sleeps, no dependence on wall-clock except injected clock behavior.
- Run
./mvnw test(Windows:mvnw.cmd test) and report only results actually run.
Checklist
- Gitea HTTP paths and failure mapping covered.
- Key and organization boundary cases covered.
- Tests are offline and deterministic.
- Test suite passes with Maven Wrapper.
Sources
- JUnit 5 User Guide: https://junit.org/junit5/docs/current/user-guide/ (consulted 2026-10-28)
- AssertJ documentation: https://assertj.github.io/doc/ (consulted 2026-10-28)
- Java HttpServer API: https://docs.oracle.com/en/java/javase/17/docs/api/jdk.httpserver/com/sun/net/httpserver/HttpServer.html (consulted 2026-10-28)
Not verified
- Plugin lifecycle integration tests against a running server are outside unit test scope.