JEasyTest is released
JEasyTest is an Eclipse plugin created to simplify unit testing of code that is hard to test using standard mock objects frameworks.
JEasyTest uses AspectJ load-time bytecode modification "to inject mock invocations" (constructor and static method invocations) where we could not using standard mock object tools.
JEasyTest has been thought to be integrated with existing mock object frameworks to overcome some of their limitations.
The new release adds Eclipse 3.3 support, JUnit4 support, an Ant task and an improved API.
In JEasyTest the bytecode is modified only at runtime just before test running, without any possibility that production code might contain unwanted testing code. Thanks to the Eclipse plugin nature, JEasyTest usage of AspectJ is completely hidden and it happens behind the scenes while we are writing tests.
Here is a simple example of test written using JEasyTest:
| Code: |
|
@ClassUnderTest(MyServiceClient.class) public class MyServiceClientTest { @JEasyTest @org.junit.Test public void runThrowsIllegalStateExceptionIfInitialContextThrowsNamingException() throws Exception { on(System.class).expectStaticNonVoidMethod("getProperty").with(arg("objectName")).andReturn("test"); on(InitialContext.class).expectEmptyConstructor().andThrow(new NamingException("message")); MyServiceClient client = new MyServiceClient(); where public class MyServiceClient { |






