package toothpick;

import org.junit.Test;

import static org.junit.Assert.fail;

//TODO more unit tests
public class InjectorTest {

  @Test(expected = IllegalStateException.class) public void testToProvider_shoudThrowException_whenBindingIsNull() throws Exception {
    //GIVEN
    InjectorImpl injector = new InjectorImpl();

    //WHEN
    injector.toProvider(null);

    //THEN
    fail("Should not allow null bindings");
  }
}

@@ -36,16 +36,184 @@
 t.Test;%0A
+import toothpick.config.Module;%0Aimport toothpick.integration.data.Foo;%0A%0Aimport static org.hamcrest.CoreMatchers.sameInstance;%0Aimport static org.junit.Assert.assertThat;
 %0Aimport 
@@ -360,12 +360,8 @@
 id t
-estT
 oPro
@@ -587,11 +587,650 @@
 s%22);%0A  %7D
+%0A%0A  @Test public void installOverrideModules_shoudInstallOverrideBindings_whenCalledOnce() %7B%0A    //GIVEN%0A    Foo testFoo = new Foo();%0A    InjectorImpl injector = new InjectorImpl(new ProdModule());%0A    injector.installOverrideModules(new TestModule(testFoo));%0A%0A    //WHEN%0A    Foo instance = injector.getInstance(Foo.class);%0A%0A    //THEN%0A    assertThat(instance, sameInstance(testFoo));%0A  %7D%0A%0A  private static class TestModule extends Module %7B%0A    public TestModule(Foo foo) %7B%0A      bind(Foo.class).to(foo);%0A    %7D%0A  %7D%0A%0A  private static class ProdModule extends Module %7B%0A    public ProdModule() %7B%0A      bind(Foo.class).to(new Foo());%0A    %7D%0A  %7D
 %0A%7D%0A

test installOverrideModules