### Question:
JcrNamespaceRegistry implements javax.jcr.NamespaceRegistry { public synchronized void unregisterNamespace( String prefix ) throws NamespaceException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(prefix, "prefix"); checkSession(); if (behavior.equals(Behavior.WORKSPACE)) { try { session.checkPermission((Path)null, ModeShapePermissions.REGISTER_NAMESPACE); } catch (AccessControlException ace) { throw new AccessDeniedException(ace); } } String uri = registry.getNamespaceForPrefix(prefix); if (uri == null) { throw new NamespaceException(JcrI18n.unableToUnregisterPrefixForNamespaceThatIsNotRegistered.text(prefix)); } if (STANDARD_BUILT_IN_PREFIXES.contains(prefix)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespacePrefix.text(prefix, uri)); } if (STANDARD_BUILT_IN_URIS.contains(uri)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespaceUri.text(prefix, uri)); } session.workspace().nodeTypeManager().signalNamespaceChanges(); try { registry.unregister(uri); } catch (RuntimeException e) { throw new RepositoryException(e.getMessage(), e.getCause()); } } JcrNamespaceRegistry( NamespaceRegistry workspaceRegistry,
                          JcrSession session );   JcrNamespaceRegistry( Behavior behavior,
                          NamespaceRegistry localRegistry,
                          NamespaceRegistry workspaceRegistry,
                          JcrSession session ); String getPrefix( String uri ); String[] getPrefixes(); String getURI( String prefix ); String[] getURIs(); synchronized void registerNamespace( String prefix,
                                                String uri ); synchronized void unregisterNamespace( String prefix ); @Override String toString();  }### Answer:
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowUnregisteringNullPrefix() throws Exception { registry.unregisterNamespace(null); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringBlankPrefix() throws Exception { registry.unregisterNamespace(""); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringJcrPrefix() throws Exception { registry.unregisterNamespace("jcr"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringNtPrefix() throws Exception { registry.unregisterNamespace("nt"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringMixPrefix() throws Exception { registry.unregisterNamespace("mix"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringSvPrefix() throws Exception { registry.unregisterNamespace("sv"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringXmlPrefix() throws Exception { registry.unregisterNamespace("xml"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringModePrefix() throws Exception { registry.unregisterNamespace("mode"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringPrefixThatIsNotUsed() throws Exception { String prefix = "bar"; assertThatNamespacePrefixIsNotRegistered(prefix); registry.unregisterNamespace(prefix); }