@Test
  public void testRegisterUnregister() throws IOException {

    // check initial state
    assertFalse("Package A is already in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertFalse("Package B is already in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertFalse("Package C is already in the registry!", packageRegistry.containsKey("c.nsuri"));

    // register C references B references A
    EcoreHelper.registerEcore(cEcorePath);
    assertTrue("Package A not in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertTrue("Package B not in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertTrue("Package C not in the registry!", packageRegistry.containsKey("c.nsuri"));

    EcoreHelper.unregisterEcore(cEcorePath);
    assertFalse("Package A is already in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertFalse("Package B is already in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertFalse("Package C is already in the registry!", packageRegistry.containsKey("c.nsuri"));
  }
  @Test
  public void testUnregisterMultipleUsage() throws IOException {
    // register
    EcoreHelper.registerEcore(aEcorePath);
    EcoreHelper.registerEcore(bEcorePath);
    EcoreHelper.registerEcore(cEcorePath);
    assertTrue("Package A not in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertTrue("Package B not in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertTrue("Package C not in the registry!", packageRegistry.containsKey("c.nsuri"));

    // unregister C references B
    EcoreHelper.unregisterEcore(cEcorePath);
    assertTrue("Package A not in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertTrue("Package B not in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertFalse("Package C is already in the registry!", packageRegistry.containsKey("c.nsuri"));

    // unregister B references A
    EcoreHelper.unregisterEcore(bEcorePath);
    assertTrue("Package A not in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertFalse("Package B is already in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertFalse("Package C is already in the registry!", packageRegistry.containsKey("c.nsuri"));

    // unregister A
    EcoreHelper.unregisterEcore(aEcorePath);
    assertFalse("Package A is already in the registry!", packageRegistry.containsKey("a.nsuri"));
    assertFalse("Package B is already in the registry!", packageRegistry.containsKey("b.nsuri"));
    assertFalse("Package C is already in the registry!", packageRegistry.containsKey("c.nsuri"));
  }
 /** @throws java.lang.Exception */
 @After
 public void tearDown() throws Exception {
   EcoreHelper.unregisterEcore(cEcorePath);
   EcoreHelper.unregisterEcore(aEcorePath);
   EcoreHelper.unregisterEcore(bEcorePath);
 }