Minimal REST API demonstrating:
- Clean controller design
- DTO validation (Jakarta Validation)
- Unit tests with MockMvc
This repository was created as a code sample for job applications.
It shows core back-end development practices:
- API design (REST endpoints for managing Todos)
- Input validation and error handling
- Automated tests to ensure reliability
./mvnw spring-boot:runOnce running, the API will be available at:
http://localhost:8080/api/todos
Once the server is running, you can interact with the API using curl, Postman, or any HTTP client.
curl http://localhost:8080/api/todosResponse:
[]curl -X POST http://localhost:8080/api/todos \
-H "Content-Type: application/json" \
-d '{ "title": "Write cover letter", "notes": "Keep it simple", "done": false }'Response:
{
"id": 1,
"title": "Write cover letter",
"notes": "Keep it simple",
"done": false
}curl http://localhost:8080/api/todosResponse:
[
{
"id": 1,
"title": "Write cover letter",
"notes": "Keep it simple",
"done": false
}
]Try creating a Todo with an empty title:
curl -X POST http://localhost:8080/api/todos \
-H "Content-Type: application/json" \
-d '{ "title": "", "notes": "missing title", "done": false }'Response (400 Bad Request):
{
"errors": [
{
"field": "title",
"message": "must not be blank"
}
]
}./mvnw testThis runs the automated unit tests (JUnit + MockMvc) that verify the API behavior.
- Java 17
- Spring Boot 3
- Maven (with Maven Wrapper for portability)
- JUnit 5 + MockMvc