This Eclipse / Maven project is an example of testing a RESTful service.
You will need Maven installed http://maven.apache.org
Then clone the repository, change to webservice-test directory and run the tests e.g.
clone https://github.com/carlbray/webservice-test.git
cd webservice-test
mvn test
This will run the com.carlbray.test.organisation.OrganisationTest and create a test report in target/surefire-reports/index.html
To ensure the tests are easy to maintain and aren't brittle I built a number of features into this framework.
Map the JSON objects into Plain Old Java Objects (POJO)
Run the JsonSchema2Pojo class. This class generates POJO classes from the referenced JSON file.
Alternatively - do it by hand
I mapped the Json objects into Plain Old Java Objects (POJO) using http://www.jsonschema2pojo.org/ This generates Jackson https://github.com/FasterXML annotated POJO classes.
Then copied each POJO into the com.carlbray.pojos.organisation package.
I used REST-Assured https://github.com/rest-assured/rest-assured to simplify the work of calling the service.
I wrapped the calling of the service into com.carlbray.utils.RestUtils.mapJsonObjects so you only need to pass in the path and the POJO class you want to use.
I used TestNG http://testng.org to simplify the work of checking results and creating test reports.
I put the data used in the testing in to a CSV file data/org-test-data.csv so more test data can be added without making code changes.