I am using ServiceLoader to dynamically load Plugins. In purpose of unit testing I want to Mock some behavior of these Plugins. These Mock-Plugins should be used when unit testing, but not when building the Project. How would one do this though?
I feel like this question is IDE / build tool specific, for that matter I am using Eclipse.
Project Structure:
- src
- app
- app.java
- scraper
- ScraperController.java
- Scraper.java
- app
- Scrapers
- tests
- mockups
- FailingScraperMock.jar
- ...
- unit_tests
- ServiceLoaderWithProvidedMockScrapersTest.java
- ...
- mockups
scraper.Scraper.java is the provider interface
Scrapers is where all the Scraper-Providers go
I tried to exclude the Mock-Plugins for the source folder: src/ . Either I am doing it wrong or that's not intended for what I am trying to do.
Would appreciate any kind of help / information.