News for hackers. Stuff that matters.
Re:Better Java – Resources for Writing Modern Java by cam- on Sunday September 20, 2015 @03:47PM (#10248758)
JMock at least blows up if you don't mock something. Powermock and Mockito will let it pass. It is a shame JMock's API is so wordy.
Re:Better Java – Resources for Writing Modern Java by mabbo on Monday September 21, 2015 @02:18PM (#10254130)
That's what I hate about JMock, lol.

You had better mock everything, and better put them in the exact order they will occur in, or your test fails.

Most JMock unit tests I see are essentially the exact same code as is being tested, written a second time in the unit test. So if I want to refactor or modify this code in any way, my unit tests break- even if functionally, my tests are doing exactly what their spec says.

With Mockito, I can say 'Hey, if anyone calls this method with parameters sort of like this, give them this response', and then focus on my unit tests actually testing the output for a given input.

Re:Better Java – Resources for Writing Modern Java by lmm on Sunday September 20, 2015 @04:29PM (#10248942)
Like I said, Easymock. Powermock has an Easymock API too if you need the mocking statics/object creation.