This figure depicts what this sample app does:
-
HTTP call to a Pokémon Store to fetch random Pokémon names.
-
It uses those names to query the DB and deduces matching and missing Pokémon in the DB.
-
It then fetches powers for those missing Pokémon from the Store via HTTP and inserts them in the DB.
It uses postgresql for DB. powers
is the only table in this DB with this simple schema:
This miniature is a multi-module project, that comprises 5 modules:
-
demo-before
— demos predominant coding and testing practices on the Core that makes unit-testing difficult -
demo-now
— demos the solution to organically improve unit-test coverage -
legacy
— This simulates legacy core modules. Assume you don’t have control over refactoring this module. -
loki
— A simulated Loki module -
loki-dud
— A simulated Dud module that contains Fakes
It’s a simple gradle project, so just run this command after clone:
./gradlew clean build
Install Docker and run this command to get the Postgresql DB up
docker compose up
Run the main method from App.kt and see it in action with pokemon.http
Find comments in the respective classes and tests for explanation.