Skip to content

Instantly share code, notes, and snippets.

@taichi
Created February 14, 2011 15:14
Show Gist options
  • Save taichi/826012 to your computer and use it in GitHub Desktop.
Save taichi/826012 to your computer and use it in GitHub Desktop.
public class Callee {
public void execute(int i) {
System.out.println(i);
}
}
public class TestTarget {
Callee callee;
public TestTarget(Callee callee) {
this.callee = callee;
}
public void invoke(int i) {
callee.execute(i * 100);
}
}
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