I am working with existing test cases that use EasyMock
to mock a class. I overloaded a no-parameter method so that now a method exists to take a string. For example:
public class HelloClass {
// This method always existed.
public String methodHello() {
...
}
// This method is new; it overloads the methodHello() method.
public String methodHello(String msg) {
...
}
}
In the test class, the HelloClass is mocked. As a result, I added the overloaded method so that we have the declaration:
public static HelloClass mockHelloClass = createMockBuilder(HelloClass.class)
.addMockedMethod("methodHello")
.addMockedMethod("methodHello", String.class)
.createMock();
However, the test cases fail when I run them. When I make the methodHello(String)
method private then the test cases pass again.
Is EasyMock
able to handle several overloaded methods being added to the createMockBuilder
?