Ejemplo n.º 1
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);
  }