这是一种无需使用EasyMock即可测试该方法的方法,但是我的建议是:如果它不是公开的,请不要为此编写测试
Method method = testMe.class.getDeclaredMethod("didIgetCalled", new Class[]{});
method.setAccessible(true);
testMe testClass = new testMe();
int invoke = (Integer) method.invoke(testClass);
assertEquals(2,invoke);
:)