The application was developed in TDD (see history)
1. Without build
Download jar from: dist/GoEuroTest.jar
2. Build with maven
- clone repository: git clone https://github.com/tonkolviktor/dev-test
- run maven package: mvn package
- jar file location: target/GoEuroTest.jar
java -jar GoEuroTest.jar Berlin
or
java -jar target/GoEuroTest.jar "Bernau bei Berlin"
The result CSV file will be: ./result.csv
mvn test
E2E tests do not run by default because e2e test actually call the backend. It can be run with the following command. See pom.xml for details on configuration.
mvn test -Pwith-e2e-tests
- Maven: dependency management, building, jar assembly
- Jersey: JAX-RS Client
- Jackson: JSON Provider
- Apache Commons
- TestNG: test runner for unit and e2e tests
- AssertJ: assertion framework, for more readable test cases
- PODAM: POjo DAta Mocker
pom.xml: maven pom file with dependencies, unit test and e2e test configuration
java/devtest/Application: Main class, error handling only here, main controller: 1. create components, 2. call backend, 3. export results
java/devtest/Argument: class to handle command line arguments
java/devtest/BusinessException: exception class used in the application
java/devtest/Configuration: default configuration values (csv column separator, backend base url, ...)
java/devtest/export/CsvExport: class to write cities to csv file. To create CSV file in java is not difficult, thus no 3rd party lib was used
java/devtest/backend/BackendService: class to call backend with Jersey/Jackson, and return cities list
java/devtest/backend/City + GeoPosition: POJO-s for representing JSON response data
test/devtest/TestUtil: common method and test variables
test/devtest/ArgumentTest: unit tests for Argument class (assert empty args...)
test/devtest/export/CsvExportTest: unit tests for CsvExport class (assert file creation, header and content)
test/devtest/e2e/backend/BackendServiceTest: e2e tests for BackendService (happy day scenario and exceptions)
test/devtest/e2e/ApplicationTest: e2e test for the whole application: (missing argument, file creation & content, ...)