For this exercise you will develop a Java console application which scrapes a portion of the Sainsbury’s Groceries website.
We are looking:
Using best practice coding methods, build a Java console application that scrapes the Sainsbury’s grocery site’s - Berries, Cherries, Currants page and returns a JSON array of all the products on the page.
For example:
title
, unit_price
, kcal_per_100g
and description
keys corresponding to items in the HTML.kcal_per_100g
field, if calories are unavailable.gross
and vat
. gross
will be the total of all the items on the page. the vat
will be the VAT on the gross amount.
The link to use is: https://jsainsburyplc.github.io/serverside-test/site/www.sainsburys.co.uk/webapp/wcs/stores/servlet/gb/groceries/berries-cherries-currants6039.html
Example JSON:
{
"results": [
{
"title": "Sainsbury's Strawberries 400g",
"kcal_per_100g": 33,
"unit_price": 1.75,
"description": "by Sainsbury's strawberries"
},
{
"title": "Sainsbury's Blueberries 200g",
"kcal_per_100g": 45,
"unit_price": 1.75,
"description": "by Sainsbury's blueberries"
},
{
"title": "Sainsbury's Cherry Punnet 200g",
"kcal_per_100g": 52,
"unit_price": 1.5,
"description": "Cherries"
}
],
"total": {
"gross": 5.00,
"vat": 0.83
}
}
We will assess the task based on the following criteria:
Please include a README.md file in the root describing how to run the app, how to run tests and any dependencies needed from the system.
Although it is desirable you complete the test, we appreciate your free time is important. Therefore, if you feel your unfinished code demonstrates the assessment criteria and can be executed, please leave some notes in your README.md explaining what you have written and what you would do next. We would be happy to review this.