|
| 1 | +# Contributing to testingbot-java |
| 2 | + |
| 3 | +Thanks for considering a contribution. This is a small library wrapping |
| 4 | +the TestingBot REST API; PRs that improve correctness, add missing |
| 5 | +endpoints, or tighten the documentation are welcome. |
| 6 | + |
| 7 | +## Building locally |
| 8 | + |
| 9 | +The project targets **Java 1.7 bytecode** so it remains usable by older |
| 10 | +consumers, but it requires a JDK that still supports `-target 1.7` |
| 11 | +(JDK 8, 11, or 17 — JDK 20+ dropped support). |
| 12 | + |
| 13 | +```bash |
| 14 | +export JAVA_HOME=$(/usr/libexec/java_home -v 11) # macOS |
| 15 | +mvn install -Dgpg.skip=true -B -V # what CI runs |
| 16 | +``` |
| 17 | + |
| 18 | +## Running tests |
| 19 | + |
| 20 | +There are three test classes: |
| 21 | + |
| 22 | +- **`TestingbotRestOfflineTest`** — unit tests; no credentials needed. |
| 23 | +- **`TestingbotRestMockTest`** — every endpoint, against a local |
| 24 | + `HttpServer`; no credentials needed. |
| 25 | +- **`TestingBotRestTest`** — **live integration tests** against the real |
| 26 | + TestingBot API. Requires `TB_KEY` and `TB_SECRET` environment |
| 27 | + variables for a valid TestingBot account, and depends on real account |
| 28 | + state (e.g. `testGetTests` expects ≥10 existing tests). |
| 29 | + |
| 30 | +Run only the offline tests: |
| 31 | + |
| 32 | +```bash |
| 33 | +mvn -Dtest='TestingbotRestOfflineTest,TestingbotRestMockTest' \ |
| 34 | + -DfailIfNoTests=false test |
| 35 | +``` |
| 36 | + |
| 37 | +Run a single test method: |
| 38 | + |
| 39 | +```bash |
| 40 | +mvn test -Dtest=TestingBotRestTest#testGetTest |
| 41 | +``` |
| 42 | + |
| 43 | +## Coding guidelines |
| 44 | + |
| 45 | +- **Keep new code Java 1.7-compatible** (try-with-resources is fine; no |
| 46 | + `var`, no `Optional`, no `java.util.Base64`, no Map.of). |
| 47 | +- **SpotBugs** runs at the compile phase with effort=Max / threshold=Low |
| 48 | + and **fails the build** on findings. Suppressions live in |
| 49 | + `findbugs-exclude.xml` — only add a `<Match>` for genuine false |
| 50 | + positives, not to mask new issues. |
| 51 | +- **Backward compatibility.** This is a published Maven Central library; |
| 52 | + do not change existing public method signatures, field types, or model |
| 53 | + field names. Add new methods/fields rather than altering old ones. |
| 54 | +- **Tests for every new endpoint.** New public methods should land with |
| 55 | + a matching test in `TestingbotRestMockTest` asserting the HTTP method, |
| 56 | + path, and any form/query encoding. |
| 57 | + |
| 58 | +## Submitting a PR |
| 59 | + |
| 60 | +1. Open an issue first for anything beyond a small fix, so we can agree |
| 61 | + on the approach. |
| 62 | +2. Keep PRs focused — one logical change per PR. |
| 63 | +3. Update `README.md` if you add or change public methods. |
| 64 | + |
| 65 | +## Releasing (maintainers only) |
| 66 | + |
| 67 | +Releases are tag-driven via `.github/workflows/release.yml`. Push a tag |
| 68 | +(`v1.x.y` or `testingbotrest-1.x.y`) and the workflow sets the version, |
| 69 | +runs the live test suite, signs and publishes to Maven Central via the |
| 70 | +Sonatype Central Portal, and creates a GitHub Release with the jars |
| 71 | +attached. See `CLAUDE.md` for the list of required GitHub secrets. |
0 commit comments