Пример #1
0
 @Test
 public void callTheSpinAndWarmUpMethods() throws Exception {
   Method accessor = checkThatSingletonContainsStaticInstanceAccessorMethod(Earth.class);
   Earth earth = (Earth) accessor.invoke(null);
   earth.spin();
   earth.warmUp();
 }
Пример #2
0
  @Test
  public void makeEarthWithAnotherClassLoader() throws Exception {
    Earth old = Earth.getEarth();

    replaceEarth(FastEarth.class.getName());
    FastEarth fast = FastEarth.class.cast(Earth.getEarth());
    assertNotSame(old, fast);

    replaceEarth(SlowEarth.class.getName());
    SlowEarth slow = SlowEarth.class.cast(Earth.getEarth());
    assertNotSame(old, slow);
    assertNotSame(fast, slow);
  }