Hypothetically I have
class Box{
Item[] items;
}
class Item{
Toy[] toys;
}
class Toy{
Color[] colors;
}
The method is to test if the Box has green color toy;
public bool testHasColor(Box){
//There will be code here that
//Streams over each type till we get to color
// Final point is
if(color==Color.GREEN){
return true;
}
}
BoxText.class
public void testBoxHasColorGreenMethod(){
// Need mocking here
}
What the best way to mock this Box class for the test case?
Thank you
testHasColormethod? If so, why would you mock theBoxclass, cause it seems to me you'd like to just pass some objects of this class to thetestHasColormethod and check whether the result is expected or not.