Top "Easymock" questions

Easymock is a mocking framework for Java.

PowerMockito mock single static method and return object

I want to mock a static method m1 from a class which contains 2 static methods, m1 and m2. And I …

java jakarta-ee mockito easymock powermock
EasyMock: Void Methods

I have a method that returns void in a class that is a dependency of the class I want to …

java unit-testing mocking void easymock
How to mock the HttpServletRequest?

I have a function that looks for a query parameter and returns a boolean: public static Boolean getBooleanFromRequest(HttpServletRequest request, …

java junit easymock
How do I mock static methods in a class with easymock?

Suppose I have a class like so: public class StaticDude{ public static Object getGroove() { // ... some complex logic which returns an …

java unit-testing static tdd easymock
java.lang.IllegalStateException: missing behavior definition for the preceding method call getMessage("title")

I'm using EasyMock(version 2.4) and TestNG for writing UnitTest. I have a following scenario and I cannot change the way …

java unit-testing testng easymock
EasyMock void method

I'm trying to use EasyMock to mock out some database interface so I can test the business logic off a …

java unit-testing testing junit easymock
EasyMock expectations with void methods

I'm using EasyMock to do some unit tests and I don't understand the usage of EasyMock.expectLastCall(). As you can …

java unit-testing easymock
How to mock a static final variable using JUnit, EasyMock or PowerMock

I want to mock a static final variable as well as mock a i18n class using JUnit, EasyMock or …

java unit-testing junit easymock powermock
EasyMock 3.0, mocking class throws java.lang.IllegalStateException: no last call on a mock available

Running the following unit test throws the exception: java.lang.IllegalStateException: no last call on a mock available import org.…

easymock
How can I mock a void method to throw an exception?

I have a structure like this: public class CacheWrapper { private Map<Object, Object> innerMap; public CacheWrapper() { //initialize the …

java unit-testing exception powermock easymock