Skip to content

Instantly share code, notes, and snippets.

@Tembrel
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tembrel/778a180412ef36f13572 to your computer and use it in GitHub Desktop.
Save Tembrel/778a180412ef36f13572 to your computer and use it in GitHub Desktop.
package org.jukito.example.bindmany;
import org.jukito.*;
import org.junit.*;
import org.junit.runner.*;
interface TestInterface {
void foo();
}
class ImplOne implements TestInterface {
public void foo() {
System.out.println("ImplOne");
}
}
class ImplTwo implements TestInterface {
public void foo() {
System.out.println("ImplTwo");
}
}
@RunWith(JukitoRunner.class)
public class BindManyTest {
public static class Module extends JukitoModule {
@Override
protected void configureTest() {
bindMany(TestInterface.class, ImplOne.class, ImplTwo.class);
}
}
public void setup(TestInterface test) {
test.foo();
}
@Test
public void testGetFlight(@All TestInterface test) {
setup(test);
test.foo();
}
}
@Tembrel
Copy link
Author

Tembrel commented Jul 22, 2015

Produces this output:

ImplOne
ImplOne
ImplTwo
ImplTwo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment