Minimal Java web app that returns simplified capital gains tax (CGT) info by country.
Frontend
- A small Tailwind UI is available at
src/main/resources/staticand served from the application root.
Quick run
- Requirements: Java 17, Maven
- Start the app:
mvn spring-boot:runOpen the UI: http://localhost:8080 API endpoint: http://localhost:8080/api/cgt?country=DE
Testing
- Run the full test suite:
mvn test- Run a single test class (example):
mvn -Dtest=com.taxlens.service.CgtServiceTest test- Run a single test method (example):
mvn -Dtest=com.taxlens.service.CgtServiceTest#usesExternalWhenConfigured testNotes on tests
- Tests use
spring-boot-starter-test(JUnit, Mockito, MockMvc). CgtServiceTestcovers the fallback JSON and the external-provider path (mockedRestTemplate).CgtControllerTestuses@WebMvcTestand a mockedCgtServiceto verify the HTTP layer.
Configuration
- To enable an external CGT provider, set
cgt.external.urlinsrc/main/resources/application.propertiesor as an environment property. Example:
cgt.external.url=https://example.com/api/cgtFallback data
- The application ships a fallback JSON at
src/main/resources/cgt-fallback.jsonused when no external provider is configured or when the external call fails.
Development tips
- To build the runnable JAR:
mvn -DskipTests package- To run the packaged JAR:
java -jar target/taxlens-0.0.1-SNAPSHOT.jarQuestions or next steps
- Add CI to run tests on push (I can add a GitHub Actions workflow).
- Add code coverage reporting (Jacoco) if you want coverage metrics.