For this following class I want to write a unit test:
public class SomeClass {
private Dependency dependency;
public SomeClass(Dependency dep){
this.dependency = dep;
}
private String processString(String s){
/*
edit the string and return
*/
}
public void doSomething(String arg){
String processed = processString(arg);
dep.doSomethingElse(processed);
}
}
At first I would stub all the methods SomeClass
calls on Dependency
in order to test my class in isolation.
But the question I couldn't yet find an answer to is :
Should I check how SomeClass
calls methods of Dependency
e.g. what parameters are passed etc. ?
Of course this is a pretty trivial example, but I want to know if this should be part of a unit test in general.
Edit: In my case Dependency
would be third party api library which I dont control. So I would consider it important what parameters are passed to these functions however I'm not sure this should be part of a unit test.