Created
February 14, 2011 15:14
-
-
Save taichi/826012 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Callee { | |
public void execute(int i) { | |
System.out.println(i); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestTarget { | |
Callee callee; | |
public TestTarget(Callee callee) { | |
this.callee = callee; | |
} | |
public void invoke(int i) { | |
callee.execute(i * 100); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.assertEquals; | |
import org.junit.Test; | |
public class TestVoid { | |
@Test | |
public void testInvoke() throws Exception { | |
TestTarget target = new TestTarget(new Callee() { | |
@Override | |
public void execute(int i) { | |
assertEquals(100, i); | |
} | |
}); | |
target.invoke(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment