Practice assignment
Backend take-home assignment example (Spring Boot)
- Java 21
- Spring Boot 3
- H2 in-memory
- 3–4 hours
- Mid / senior
A small webshop needs a backend service to accept and track orders. You get a Spring Boot 3 / Java 21 starter, a fixed HTTP contract under /api/orders, and tests that stay red until the service, validation and error mapping are in place.
The starter
Requirements
POST /api/orderswith{customerEmail, lines:[{sku, quantity, unitPrice}]}— validate the body, lower-case the email, set statusNEW, computetotalas the sum of quantity × unitPrice rounded HALF_UP to 2 decimals once, return201and aLocation.GET /api/orders/{id}—200or404 ORDER_NOT_FOUND.GET /api/orders?status=PAID— optional filter.PATCH /api/orders/{id}/status— onlyNEW→PAID|CANCELLEDandPAID→SHIPPED|CANCELLED; anything else is409 INVALID_STATUS_TRANSITION.
Every error body is JSON {code, message}. Unreadable JSON is the same 400 VALIDATION_FAILED as a field error.
Grading rubric
| Area | Points |
|---|---|
| Correctness (provided tests) | 30 |
| Validation & error contract | 15 |
| Domain logic: state machine, BigDecimal money | 15 |
| Own tests | 15 |
| Structure: DTO vs entity, @Transactional | 10 |
| API design: 201 + Location, status codes | 5 |
| NOTES.md trade-offs (pagination, idempotency, locking) | 10 |
Levels: junior ≥ 60, mid ≥ 75, senior ≥ 85 (and a strong NOTES.md).
What reviewers look for
- Whether money is
BigDecimaland rounded once, not per line and never withdouble. - A closed status machine — self-transitions should fail, not “succeed with no change” unless the brief says so.
- A clear split between controller, service and exception handler, and tests that mention the
codefield, not only the HTTP status. - A NOTES.md that talks about idempotency keys, pagination and lost updates — even if you did not build them.
Common mistakes
- Using
doublefor money.1 × 1.005will not reliably become1.01. - Rounding each line and then summing, which disagrees with “round the total once”.
- Returning
200on create, or a bare404with nocode. - Putting all logic in the controller, or loading every order and filtering in Java when a query would do.
- Skipping NOTES.md. Senior is explicitly “≥ 85 and a strong NOTES.md”.
How to run it
Run mvn verify. The provided tests fail on the starter and must pass on your solution. Add your own tests; they are part of the grade.
The free no-account sample is a Spring Boot CSV import in the same style. Or paste a job ad and generate an orders-style task.
Download the Spring Boot sample ZIP Generate one from a job adRelated practice tasks
Frequently asked questions
- What does a Spring Boot take-home usually look like?
- A small but complete service: a documented HTTP contract, an in-memory or containerised database, provided tests that fail on the starter, and a NOTES.md for trade-offs you did not have time to build.
- How is this different from a LeetCode-style coding test?
- You are graded on validation, error codes, money or state rules, and the shape of the code, not on an algorithm puzzle. The provided tests are the specification.
- Can I download this starter?
- This page describes the orders-API template. The free no-account ZIP on the site is a securities CSV-import task in the same style. You can also generate an assignment from a job posting.
Practice only. This is an original HireCheck practice assignment, not a real employer's take-home, and it is not affiliated with any company mentioned as a role example.