Examples of GuiceBerryJunit3


Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

      public void tearDown() throws Exception {
        currentUniverse = null;
      }
    });
    currentUniverse = new GuiceBerryUniverse();
    return new GuiceBerryJunit3(new GuiceBerry(currentUniverse));
  }
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

  }
 
  public void testThatTwoTestsWithSameGbeUseTheSameInjector()
      throws ClassNotFoundException {
    NonTdtcForGbeOne testOne = NonTdtcForGbeOne.createInstance();
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    guiceBerryJunit3.doSetUp(testOne);
   
    Injector injectorOne = currentUniverse.gbeClassToInjectorMap.get(Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE));
    GuiceBerryJunit3.tearDown(testOne);

    AnotherNonTdtcForGbeOne testTwo = AnotherNonTdtcForGbeOne.createInstance();
    guiceBerryJunit3.doSetUp(testTwo);
   
    Injector injectorTwo =
      currentUniverse.gbeClassToInjectorMap.get(Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE));

    // "number" is bound to a random, so this will only pass if the injector
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

    JUnitAsserts.assertNotEqual(testOne.number, testTwo.number);
  }

  public void testPutTwoInjectorsInMapForTestsThatDeclareDifferentGbes() {
    NonTdtcForGbeOne testOne = NonTdtcForGbeOne.createInstance();
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    guiceBerryJunit3.doSetUp(testOne);
    GuiceBerryJunit3.tearDown(testOne);
   
    TestWithGbeTwo testTwo = TestWithGbeTwo.createInstance();
    guiceBerryJunit3.doSetUp(testTwo);
  
    assertEquals(2, currentUniverse.gbeClassToInjectorMap.size());
  }
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

    } catch (RuntimeException expected) {}
  }
  public void testCallingTwoSetupWithNoTearDownBetween() {
    TestWithGbeOne test = TestWithGbeOne.createInstance();
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    guiceBerryJunit3.doSetUp(test);
    try {
      guiceBerryJunit3.doSetUp(test);
      fail();
    } catch (RuntimeException expected) {}  
  }
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

    test.run();
  }
 
  public void testMethodTearDownForTestCaseNotCalledAutomatically() {
    NonTdtcForGbeOne testOne = NonTdtcForGbeOne.createInstance();
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    guiceBerryJunit3.doSetUp(testOne);
    testOne.run();

    TestWithGbeOne testTwo = TestWithGbeOne.createInstance();
    try
      guiceBerryJunit3.doSetUp(testTwo);
      fail();
    } catch (RuntimeException expected) {}
  }
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

    assertTrue(baz < baz2);  
  }

  public void testTestScopeIsCreatedForModule()
      throws ClassNotFoundException {
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    TestWithGbeOne test = TestWithGbeOne.createInstance();
   
    assertNull(
      currentUniverse.gbeClassToInjectorMap.get(
        Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE)));
    guiceBerryJunit3.doSetUp(test);
    TestScope testScope =
      currentUniverse.gbeClassToInjectorMap.get(
        Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE))
        .getInstance(TestScope.class);
    assertNotNull(testScope);
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

    return injector.getInstance(TestScope.class);
  }
 
  public void testReUseTestScopeByTwoTestsWithSameGbe()
    throws ClassNotFoundException{
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    TestWithGbeOne testOne = TestWithGbeOne.createInstance();
    assertNull(
        getTestScopeForGbe(
            Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE)));
    guiceBerryJunit3.doSetUp(testOne);
    TestScope testScopeOne =
      getTestScopeForGbe(
          Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE));
    assertNotNull(testScopeOne);
   
    testOne.run();
  
    AnotherTestWithGbeOne testTwo =
      AnotherTestWithGbeOne.createInstance();
    guiceBerryJunit3.doSetUp(testTwo);
    assertNotNull(getTestScopeForGbe(
        Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE)));
   
    TestScope testScopeTwo =
      getTestScopeForGbe(
View Full Code Here

Examples of com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3

    assertEquals(1, currentUniverse.gbeClassToInjectorMap.size());
 

  public void testThatTestsWithDifferentGbesGetDifferentTestScopes()
      throws ClassNotFoundException {
    GuiceBerryJunit3 guiceBerryJunit3 = instance();
    TestWithGbeOne testOne = TestWithGbeOne.createInstance();
  
    assertNull(getTestScopeForGbe(
        Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE)));
    guiceBerryJunit3.doSetUp(testOne);
    TestScope testScopeOne =
      getTestScopeForGbe(
          Class.forName(GuiceBerryEnvOne.GUICE_BERRY_ENV_ONE));
    assertNotNull(testScopeOne);
 
    testOne.run();
   
    TestWithGbeTwo testTwo = TestWithGbeTwo.createInstance();
    guiceBerryJunit3.doSetUp(testTwo);
    assertNotNull(getTestScopeForGbe(
        Class.forName(GuiceBerryEnvTwo.GUICE_BERRY_ENV_TWO)));
    TestScope testScopeTwo =
      getTestScopeForGbe(
          Class.forName(GuiceBerryEnvTwo.GUICE_BERRY_ENV_TWO));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.