@Test public void testRun() throws Exception { Logger logger = createMock(Logger.class); expectNew(Logger.class).andReturn(logger); logger.log("Hello"); expectLastCall().times(10); replay(logger, Logger.class); invokeMethod(new Greeter(), "run", 10, "Hello"); verify(logger, Logger.class); }
private void run(int count, String message) { Logger logger = new Logger(); for(int indx=0; indx<count; indx++){ logger.log(message); } }
Greeter { private void run(int count, String message) { Logger logger = new Logger(); for(int indx=0; indx<count; indx++){ logger.log(message); } } }
Greeter { private void run(int count, String message) { Logger logger = new Logger(); for(int indx=0; indx<count; indx++){ logger.log(message); } }  }
Greeter { private void run(int count, String message) { Logger logger = new Logger(); for(int indx=0; indx<count; indx++){ logger.log(message); } }  static void main( String[] args ); }
Greeter { private void run(int count, String message) { Logger logger = new Logger(); for(int indx=0; indx<count; indx++){ logger.log(message); } }  static void main( String[] args );  }