This repo contains the exercises that accompany QualiMente's Building High-Quality Software workshop for Java.
The following exercises are intended to help the student practice quality assurance methods such as testing and inspection.
Complete each exercise using the recommended quality assurance methods:
- automated testing via either a Test-Driven Development or Test Now approach
- inspection via code review or pair programming
- static analysis by executing and reviewing reports bundled with the project
mvn clean verify should always succeed when an exercise has been completed.
The exercises project requires:
or Docker
Use Test Driven Development and pair programming to add the following features:
- Add a
namefield to the Address domain model. Questions:- Should name be modeled as one field, two, many?
- What determines whether a name is valid?
- Add an
emailfield to the Address domain model. Questions:- Should there be a single email field or a Map of email addresses keyed by Home, Work, etc
- What determines whether an email address is valid?
- How far should validation be taken in this application?
Use 'Test Now' development and code review via a partner to add the following features:
- Use LocationDataValidator to validate the country prior to storing an Address. Questions:
- Should Address' country field be renamed to countryCode?
- When should the validation be done: in domain model, controller, DAO, other?
- Use LocationDataValidator to validate postal codes prior to storing an Address. Questions:
- Since postal codes schemes are country-specific, should modification of country and postalCode be tied-together?
- When should the validation be done: in domain model, controller, DAO, other?
- Add support for updating an existing address. Questions:
- What will happen if/when concurrent requests to update an Address occur?
- Refactor LocationDataValidator so that it:
- follows the Single Responsibility Principle
- does not hinder unit-testing of classes trying to use it, e.g. Address or Controller
- has > 90% unit test coverage by line
- validates ISO 3166 alpha-2 country codes correctly
- validates country-specific postal codes are (or may be for certain countries) correct
This project has a small, but very-useful, set of quality reporting configured:
- FindBugs: use static analysis to find bugs in the code
- JaCoCo: analyze coverage of unit and integration tests
The reporting is created as part of the standard Maven 'site' generation facility:
mvn clean verify site
and the generated site is available at target/site/index.html
This project may also be built with Docker and Docker Compose:
- build project:
docker-compose run build - generate reports:
docker-compose run reports - run the server:
docker-compose run --service-ports server - build a portable service runtime image:
docker-compose build runtime-image - run the server image:
docker-compose run --service-ports runtime-image
Thank you to GeoNames for providing the great location reference data used within these exercises. Location data is licensed under the Creative Commons Attributions License.