Let's do some functional code in Java!
- Java 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .mvn/wrapper | ||
| .vscode | ||
| src | ||
| .gitignore | ||
| mvnw | ||
| mvnw.cmd | ||
| pom.xml | ||
| README.md | ||
| skyspell-ignore.toml | ||
Java Funk Kata
Goal
Learn about functional style in Java
Context
- A database of books
- A external API that can list translations given a book ID
What the code does
You have a controller that needs to:
- look up the book in the database
- make the API call
If all went well, return "200" and the list of known translations
If the book was not found, or the external API returns 404, returns 404
If the external API returns something else (like 400 for instance), return 500
Instructions
- Make sure you understand the production and the test code, and that you can run the tests.
- Replace all the nulls and try/excepts with Optional and vavr.Either
- Discuss !