Let's do some functional code in Java!
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-08 19:34:35 +02:00
.mvn/wrapper initial commit 2026-09-08 17:01:28 +02:00
.vscode initial commit 2026-09-08 17:01:28 +02:00
src Move ApiCallError into infra 2026-09-08 19:29:33 +02:00
.gitignore initial commit 2026-09-08 17:01:28 +02:00
mvnw initial commit 2026-09-08 17:01:28 +02:00
mvnw.cmd initial commit 2026-09-08 17:01:28 +02:00
pom.xml initial commit 2026-09-08 17:01:28 +02:00
README.md Fix typos 2026-09-08 19:34:35 +02:00
skyspell-ignore.toml Fix typos 2026-09-08 19:34:35 +02:00

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

  1. Make sure you understand the production and the test code, and that you can run the tests.
  2. Replace all the nulls and try/excepts with Optional and vavr.Either
  3. Discuss !