I believe you should be familiar with this idiom, which is some kind of Java excuse for closing
public void process(Command cmd){
ExpensiveResource resource = new ExpensiveResource();
cmd.execute(resource);
resource.close();
}
manager.process(new Command(){
public void execute(ExpensiveResource res){
}
});
I used this idiom / template a lot, but recently I tried to test it and it gave me a headache ...
How can you test the isolated class ResourceManager and Client? I have found that it is so closely related to them that you cannot do it easily.
Ideas appreciated.
Hello
source
share