easymock

Can mockito or easymock replace rmock

I'm sitting with a legacy project, and we're starting to replace some old legacycode. As Rmock don't have support for junit4, we would like to replace it. One thing i was wondering is - how could i replace the dynamictestsuite feature of rmock. This is a good feature where you create a dynamic testsuite for each run, and can do stuff lik...

EasyMock - How to mock the cast operation

How can I mock the cast operation. I have an cast operation on a dependent object , which will cast to another dependent object like SqlMapClient sqlMapClient; SqlMapClientImpl sqlMapClientImpl = (SqlMapClientImpl) sqlMapClient I' mocking both the dependent clesses i.e SqlMapClient and SqlMapClientImpl .But I need to know how to mock...

How to mock the view in the MVC integration testing using JUnit and EasyMock

Hi, I would like to mock a view implementation of the MVC design pattern. I have implemented the MVP(another MVC variation), and would like to test if the certain methods in the view get called correctly by the controller when a state change happens on the model. The following shows the sequence of method calls on the model, controller ...

Test that void method didn't get called with EasyMock

Is this possible? I tried with EasyMock.expectLastCall().times(0); but EasyMock complains that times must be >=1 ...

How to turn off recording for an EasyMock object?

I am testing a servlet's doPost() method using EasyMock objects for the HttpServletRequest and HttpServletResponse arguments. Within the doPost() method I'm testing the request and response objects are used as arguments to a static method class for another class, and I want to disregard (i.e. not record as expected) any calls made on th...

EasyMock andReturn() vs andStubReturn()

I'm still a rather new developer,so I might not have a grasp on all the concepts and terms which could be the reason why I don't understand this. But what exactly is the difference between using andReturn(T value) vs andStubReturn(T value) for EasyMock? Both of their parameter types are the same. In what situation would it require you d...

How to test the order of mocked calls using EasyMock

Hi, It's easy enough in EasyMock to do: EasyMock.expect(service.methodCall()); but I noticed that this does not test the order in which I execute the calls, which in a case that I am trying to test is very important. Is there anyway to do this with EasyMock? ...

Mock object creation inside a method

If I have the following method: public void handleUser(String user) { User user = new User("Bob"); Phone phone = userDao.getPhone(user); //something else } When I'm testing this with mocks using EasyMock, is there anyway I could test the User parameter I passing into my UserDao mock like this: User user = new User("Bob")...

EasyMock methods with parameters returning void

My unit test framework replaces business service components with Mock objects using EasyMock.createMock(Interace). These components are accessed several layers down in the class under test so I don't wish to modify either the interface definition nor the class undertest. I then use EasyMock.expect(...) to drive the behavoir of the co...

How can I unit-test subflows in Spring Webflow 1.0?

Unit testing subflows in SWF 2.0 with mocks seems pretty straight forward, as Spring's reference clearly shows. My problem is with registering the subflow, because I can't find a way to access the flow definition registry using 1.0 API. Is there any way to register a subflow on the fly, in order to unit-test the flow? ...

How do I remove the warning from a EasyMock.anyObject(List.class) call

Compiler can't stop complaining with this call : EasyMock.anyObject(List.class) I tried to specify list's type EasyMock.anyObject(List<MyType>.class) but it doesn't seems to be an option (anyway, it is stupid since java will erase the type during the compilation) Is there a clean way (@SuppressWarning is not a clean way IMO) to ...

JUnit mocking with Mockito, EasyMock, etc

I'm trying to mock a method of an object inside the class I'm testing. For instance class ClassToTest { public doSomething () { SomeObject a = new SomeObject (); a.doSomethingElse (); } } Is there a way to mock the methods of the variable "a"? I'd like doSomethingElse to do nothing during testing. I'm currentl...

What's the best way to set an Eclipse breakpoint on a EasyMock expect call?

I have code like ClockService mockClockService = createMock( ClockService.class ); Long timeFirstNodeCreated = new Date().getTime(); expect( mockClockService.getNow() ).andReturn( timeFirstNodeCreated ) ; Long timeFirstNodeDeleted = new Date().getTime(); expect( mockClockService.getNow() ).andReturn( timeFirstNodeDeleted ) ; ...

Using normal mock and NiceMock within the same mockControl

Is it possible to use a niceMock and a "normal" mock within the same mockControl object? Currently if I try to set one of the mock to nice someMock = mockControl.createMock(someClass.class); EasyMock.resetToNice(someMock); It seems to reset the entire control to nice So i would like a way to have different mock type in the same co...