When I use the following test I get a WARNING:
WARNING: JMockit was initialized on demand, which may cause certain tests to fail; please check the documentation for better ways to get it initialized.
This is my test implemenation:
package test;
import static mockit.Mockit.*;
import junit.framework.TestCase;
import mockit.*;
import mockit.integration.junit4.*;
import org.junit.*;
import org.junit.runner.*;
import filip.ClassUnderTest;
import filip.LowerClass;
@RunWith(JMockit.class)
public class MockTest extends TestCase {
@MockClass(realClass = LowerClass.class)
public static class LowerClassMock {
@Mock(invocations = 1)
public String doWork() {
return "Mockowanie dziala :D";
}
}
@Before
public void setUp() { setUpMocks(LowerClassMock.class); }
@After
public void tearDown() { tearDownMocks(); }
@Test
public void testJMockit() {
ClassUnderTest classUnderTest = new ClassUnderTest();
classUnderTest.print();
}
}
Any ideas?