- Fork and Clone this repo
- Work on the requirements
- Create a file
instructions.md
for the instructions needed to run the project - Do a PR with your code and any other needed information
- Send an email notifying us
We want to see your proficency modeling a problem with code. How you structre it, how you test. While a working application is a big plus, if not working please submit it anyway.
IMPORTANT
The business logig has been kept small on porpuse, however, structure your code as this were a big application. Apply SOLID principles.
- Choose the language you feel most confortable with
- Use of a framework
- Unit tests & Integration tests
- The application has to be self-contained. That is, should not depend on extenernal conections not provided with it.
Use in memory storage. Do not depend on an instaled database.
Create an application listening to port 8085, and:
The application should be able to receive a
POST http://localhost:8055/api/register
with payload (store it as a shipment
):
{
"reference":"ABCD123456",
"parcels" : [
{
"weight":1,
"width": 10,
"height": 10,
"lenght": 10
},
{
"weight":2,
"width": 20,
"height": 20,
"lenght": 20
}
]
}
The application should be able to receive a
PUT http://localhost:8055/api/push
with the following payloads (tracking
):
{
"status":"WAITING_IN_HUB",
"parcels":2,
"weight":null,
"reference":"ABCD123456"
}
{
"status":"WAITING_IN_HUB",
"parcels":2,
"weight":2,
"reference":"ABCD123456"
}
{
"status":"WAITING_IN_HUB",
"parcels":1,
"weight":15,
"reference":"ABCD123456"
}
{
"status":"WAITING_IN_HUB",
"parcels":2,
"weight":30,
"reference":"ABCD123456"
}
{
"status":"DELIVERED",
"parcels":2,
"weight":2,
"reference":"ABCD123456"
}
{
"status":"DELIVERED",
"parcels":2,
"weight":30,
"reference":"ABCD123456"
}
{
"status":"DELIVERED",
"parcels":2,
"weight":30,
"reference":"EFGH123456"
}
{
"status":"DELIVERED",
"parcels":null,
"weight":30,
"reference":"ABCD123456"
}
Using the above examples:
Given the provided shipment
When
shipment
reference should be equal totracking
referenceshipment
parcel number should be equal totracking
parcel number.shipment
total weight should be less thantracking
weight.tracking
status should beDELIVERED
Then dispatch an application event
{
"reference":"ABCD123456",
"status": "CONCILLIATION_REQUEST"
}
AND print it into the console
Given the provided shipment
When
shipment
reference should be equal totracking
reference.shipment
parcel number should be equal totracking
parcel number.shipment
total weight should be greater or equal thantracking
weight.tracking
status should beDELIVERED
.
Then dispatch an application event
{
"reference":"ABCD123456",
"status": "NOT_NEEDED"
}
AND print it into the console
Given the provided shipment
When
shipment
reference should be equal totracking
referencetracking
status is notDELIVERED
Then dispatch an application event
{
"reference":"ABCD123456",
"status": "INCOMPLETE"
}
AND print it into the console
Given the provided shipment
When
shipment
reference should be equal totracking
reference- any other
tracking
field is null
Then dispatch an application event
{
"reference":"ABCD123456",
"status": "INCOMPLETE"
}
AND print it into the console
Given the provided shipment
When
tracking
reference is not equal toshipment
reference
Then dispatch an application event
{
"reference":"EFGH123456",
"status": "NOT_FOUND"
}
AND print it into the console