Not sure how to with pure EasyMock, but consider using the PowerMock extensions to EasyMock.
It has a lot of cool functions for doing just what you need –
https://github.com/jayway/powermock/wiki/MockStatic
More Related Contents:
- How do I test a class that has private methods, fields or inner classes?
- Mocking static methods with Mockito
- How to verify that a specific method was not called using Mockito?
- How to mock a static final variable using JUnit, EasyMock or PowerMock
- Static class instance inside class
- What does the ‘static’ keyword do in a class?
- Difference between Static methods and Instance methods
- PowerMockito mock single static method and return object
- Getting the class name from a static method in Java
- Why can’t we have static method in a (non-static) inner class (pre-Java 16)?
- Why can’t we use ‘this’ keyword in a static method
- Why can’t I declare static methods in an interface?
- Invoking a static method using reflection
- static allocation in java – heap, stack and permanent generation
- How to test void method with Junit testing tools?
- Mockito: InvalidUseOfMatchersException
- How to use ArgumentCaptor for stubbing?
- annotation to make a private method public only for test classes [duplicate]
- Grouping JUnit tests
- Mockito, JUnit and Spring
- How do I assert an Iterable contains elements with a certain property?
- Are static variables inherited
- What does `public static void main args` mean?
- junit & java : testing non-public methods [duplicate]
- Order of static variable initialization, Java [duplicate]
- Can we call a static method with a null object in Java? If so, how?
- Unit testing a Java Servlet
- Class Not Found: Empty Test Suite in IntelliJ
- TestNG: How to test for mandatory exceptions?
- Static variables and multithreading in java