JUnit is a unit testing framework for the Java language.

learn more… | top users | synonyms

3
votes
2answers
123 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
112 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
452 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 ...