java - Unit testing a service, which works as a mediator between two other services -


i have service, works mediator between 2 other services. validates inputs, passes them 2 service sequentially (by trying keep transactional integrity), , then, if goes well, saves result database.

my problem test service in isolation. of course, can provide stubs satisfy dependencies. can test validation of inputs, whether appropriate data saved in db in normal case, whether transactional integrity kept if of dependencies throws exception.

yet, half of service does. dilemma if should try prove whether other 2 dependency services processed data appropriately well? scope of service quite broad, guess better know if dependency services did job well. yet, gets out of scope unit testing, , moves integration testing, right?

i kind of confused here.

if you're asking unit-testing, way test class in isolation using mocks or stubs.

but, if feel doing not enough, can write component tests, use real classes want test, , use stub (or inmemory) database , mock of dependencies consider not important trying test.

in past, i've tested small clusters of classes had high interaction between them in way (and skipping unit-tests classes, component tests covered scenarios). obviously, problem doing number of scenarios grows exponentially more classes you're testing. maybe can test bridge , 2 real classes use bridge.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -