AliasRegistryImpl extends ComponentSupport implements AliasRegistry { @Override public void removeAlias(final String name) throws NoSuchAliasException { checkNotNull(name); log.debug("Removing alias: {}", name); if (!containsAlias(name)) { throw new NoSuchAliasException(name); } aliases.remove(name); events.publish(new AliasRemovedEvent(name)); } @Inject  AliasRegistryImpl(final EventManager events); @Override void registerAlias(final String name, final String alias); @Override void removeAlias(final String name); @Override String getAlias(final String name); @Override boolean containsAlias(final String name); @Override Map<String, String> getAliases();  }
@Test public void testRemoveAliasInvalid() throws Exception { try { underTest.removeAlias(null); fail(); } catch (NullPointerException e) { } }
@Test public void testRemoveAlias() throws Exception { assertFalse(underTest.containsAlias("foo")); try { underTest.removeAlias("foo"); } catch (AliasRegistry.NoSuchAliasException e) { } testRegisterAlias(); underTest.removeAlias("foo"); assertFalse(underTest.containsAlias("foo")); }