Builders; not building?
I had an issue with a builder. I had used it like this:
reportCreator.start(game, raceId).type(PlanetHasBuiltMinesReport.class)
.addArguments(name, numberOfItems);
My Test showed that it was not working - the report was not created - and it took me a while to find the cause. It should have been:
reportCreator.start(game, raceId).type(PlanetHasBuiltMinesReport.class)
.addArguments(name, numberOfItems).create();
As you can see, the omission is hard to spot.
So I think, maybe one should always pass a parameter with the last method - so that the call is not forgotten.
reportCreator.start(game, raceId)
.addArguments(name, numberOfItems)
.create(PlanetHasBuiltMinesReport.class);
Looks strange?
Written on November 14, 2019