Skip to content

Implement Strategy Pattern, Cache Preload, Unit & Integration Tests#178

Open
AchmadSu wants to merge 4 commits intoallobankdev:mainfrom
AchmadSu:main
Open

Implement Strategy Pattern, Cache Preload, Unit & Integration Tests#178
AchmadSu wants to merge 4 commits intoallobankdev:mainfrom
AchmadSu:main

Conversation

@AchmadSu
Copy link

@AchmadSu AchmadSu commented Mar 4, 2026

Summary

This PR implements the required architecture for the finance application:

  • Strategy Pattern for IDRDataFetcher
  • Cache layer to avoid repeated external API calls
  • ApplicationRunner to preload external API data at startup
  • ExternalApiService to encapsulate WebClient logic
  • Unit tests for all strategy implementations
  • Integration test for ApplicationRunner preload process

Key Improvements

  • Clean separation of concerns (Runner → Service → WebClient)
  • External API calls are mocked in tests
  • No external dependency during test execution
  • Spread calculation logic covered by unit test

Test Coverage

  • Unit tests:
    • LatestRateStrategy
    • HistoricalRateStrategy
    • SupportedCurrenciesStrategy
  • Integration test:
    • DataPreloadRunner

How To Run

Notes

WebClient configuration added via WebClientConfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant