I am trying to create a unit test builder style template that looks like this (mockedObject is injected into a function, so I can mock it):
Thing thing = mockedObject.createThing() .addParam1() .addParam2(mockedObject.createParam2() .someData() .build()) .build(); mockedObject.use(thing);
I am trying to figure out how to test this (using JUnit and Easymock) without having to mock the entire builder. All I need to check on the resulting object is that param1 and param2 were set with certain values.
Erupting the entire builder pattern would make the test extremely fragile, and its not something I should test for a start.
Is there a better way to test this?
source share