0
votes
1answer
40 views

Review of the testing code that I have written using easymock/junit

I have these classes that have boilerplate way of initialization. So, instead of writing it each time, I wrote a class called MockUtil.java where I put the boilerplate mocks in there. MockUtil has ...
3
votes
2answers
126 views

How can I optimize this code for unit testing

How can i optimize this code with less number of loops and return values for unit testing public class Diamond { public void DiamondShape(int num) { for(int ucount=num;ucount>0;ucount--) { ...
3
votes
1answer
115 views

Designing a listener method and making it Testable

I have a java based server application that needs to support multiple clients. In the main class I have a method that runs in an infinite loop and waits for client connection. Following is this ...
2
votes
2answers
468 views

Tesing a simple calculator class with JUnit/JMock

I'm playing around with JMock and trying to understand whether I understand the idea correctly. There's an interface Printer aimed to print integers somewhere. There's an interface Calculator aimed ...