### Question:
JcrRepository implements Repository { public String getDescriptor( String key ) { if (!isSingleValueDescriptor(key)) return null; JcrValue value = (JcrValue)descriptors.get(key); try { return value.getString(); } catch (RepositoryException re) { throw new IllegalStateException(re); } } @SuppressWarnings( "deprecation" )  JcrRepository( ExecutionContext executionContext,
                   RepositoryConnectionFactory connectionFactory,
                   String repositorySourceName,
                   Observable repositoryObservable,
                   RepositorySourceCapabilities repositorySourceCapabilities,
                   Map<String, String> descriptors,
                   Map<Option, String> options,
                   String initialContentForNewWorkspaces ); Map<Option, String> getOptions(); String getDescriptor( String key ); JcrValue getDescriptorValue( String key ); JcrValue[] getDescriptorValues( String key ); boolean isSingleValueDescriptor( String key ); boolean isStandardDescriptor( String key ); String[] getDescriptorKeys(); synchronized Session login(); synchronized Session login( Credentials credentials ); synchronized Session login( String workspaceName ); synchronized Session login( Credentials credentials,
                                       String workspaceName ); Metrics getMetrics();  }### Answer:
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowNoDescriptorKey() { repository.getDescriptor(null); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowEmptyDescriptorKey() { repository.getDescriptor(""); }
@Test public void shouldNotProvideRepositoryWorkspaceNamesDescriptorIfOptionSetToFalse() throws Exception { JcrConfiguration config = new JcrConfiguration(); config.repositorySource("Store").usingClass(InMemoryRepositorySource.class); config.repository("JCR") .setOption(JcrRepository.Option.EXPOSE_WORKSPACE_NAMES_IN_DESCRIPTOR, Boolean.FALSE.toString()) .setSource("Store"); JcrEngine engine = config.build(); engine.start(); assertThat(engine.getRepository("JCR").getDescriptor(org.modeshape.jcr.api.Repository.REPOSITORY_WORKSPACES), is(nullValue())); engine.shutdownAndAwaitTermination(3, TimeUnit.SECONDS); }
@Test public void shouldProvideUserSuppliedDescriptors() throws Exception { Map<String, String> descriptors = new HashMap<String, String>(); descriptors.put("property", "value"); Repository repository = new JcrRepository(context, connectionFactory, sourceName, new MockObservable(), null, descriptors, null, null); testDescriptorKeys(repository); testDescriptorValues(repository); assertThat(repository.getDescriptor("property"), is("value")); }