#Trip-agency kata
This kata has has two main goals :
- to teach the basis of BDD (Behaviour Driven Development)
- to use the hexagonal architecture, an architectural pattern allowing to dissociate domain code and technical code.
You are in charge of a travel agency in the town of Lille which sells trips all around the world. The price of a trip is composed of the agency fees, the ticket price and the travel fees (hotels room, taxi, etc ...). The ticket price can change depending if you are in business, first or economic class. In first class, the ticket costs two times the price of an economic one. In business class, the ticket costs five times the price of an economic one.
You'll have to develop an application responding to the previous need.
The goal is to determine the price of a trip which is here the sum of three numbers, the agency fees the ticket price and the travel fees. It's possible for a customer to decide in which travel class he will travel.
You'll have to develop the core domain application following the next two rules:
- by doing the tests first, i.e. defining the behaviour, with the domain people and QA first.
- without relying on a real infrastructure by mocking the data provider (db, rest services, ...)
The second point can be done by mocking the intention represented by the java interfaces (for example in a java project).
Based on the project made in the first part, you'll now just have to implement the adapters based on the ports (the java interfaces
here) defined previously.
You can exposed your service via a rest service.
The repository adapter code can have values hard coded in a java class. In principle, it will be quickier to implement it like this.
The branch master as you can see contains only the README.md
You can use the following branches to help you doing some parts of this kata
It contains a maven project template.
The dependencies and code already implemented allow you to work directly with cucumber.
For the cucumber configuration look at the following class : BDDRunner
You should see or configure in which folders you can make the features files and the package in wich code the glue.
01_template branch + the cucumber features files and the methods signatures in the java glue part.
02_cucumber_features branch + one implementation of the domain and cucumber glue code implemented.
03_BDD_solution branch + the two technical modules
- the exposition module contains all that is required to do a rest call
- the infrastructure module contains only dependencies to the domain module. You'll have to implement the adapters
04_HA_adapter_to_develop + one possibility for the adapter part
you can start the rest exposition by executing the following command line in the exposition folder:
mvn clean spring-boot:run
The url to use the service is the following:
http://localhost:12378/trip-agency/swagger-ui/
Ubiquitous language
Specifications by examples implemented with Cucumber
Cukedoctor
See in the following repository in the domain module : domain/target/TripAgency
You should see a pdf file containing the results of the cucumber tests.
AssertJ + Mockito + Cucumber
Multi modules:
- domain (the most important module)
- infrastructure (infrastructure repository) and exposition (infrastructure driver) for the technical ones
Database version control and deployment
Swagger2