1 package net.pterodactylus.util.inject;
3 import com.google.inject.Guice;
4 import com.google.inject.Injector;
5 import org.hamcrest.MatcherAssert;
6 import org.hamcrest.Matchers;
10 * Unit test for {@link ObjectBinding}.
12 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
14 public class ObjectBindingTest {
17 public void constructorCanBeCalled() {
22 public void objectIsBound() {
23 TestClass testObject = new TestClass();
24 Injector injector = Guice.createInjector(ObjectBinding.forClass(TestInterface.class).is(testObject));
25 MatcherAssert.assertThat(injector.getInstance(TestInterface.class), Matchers.sameInstance(testObject));
28 public interface TestInterface { }
30 public static class TestClass implements TestInterface { }