RepositoryFacade implements Repository { @Override public Value getDescriptorValue(String key) { return delegate != null ? delegate.getDescriptorValue(key) : null; } @SuppressWarnings("WeakerAccess")  RepositoryFacade(final @Nullable Repository delegate); @Override String[] getDescriptorKeys(); @Override boolean isStandardDescriptor(String key); @Override boolean isSingleValueDescriptor(String key); @Override Value getDescriptorValue(String key); @Override Value[] getDescriptorValues(String key); @Override String getDescriptor(String key); @Override Session login(Credentials credentials, String workspaceName); @Override Session login(Credentials credentials); @Override Session login(String workspaceName); @Override Session login();  }
@Test public void testGetDescriptorValue() { final Repository mockRepository = mock(Repository.class); final String key = "SOME_KEY"; final Value value = new SimpleValueFactory().createValue("SOME_VALUE"); when(mockRepository.getDescriptorValue(anyString())).thenReturn(null); when(mockRepository.getDescriptorValue(key)).thenReturn(value); final RepositoryFacade facade = getFacade(mockRepository); assertSame("should be same value", value, facade.getDescriptorValue(key)); assertNull("should be null", facade.getDescriptorValues("")); final RepositoryFacade facadeNull = getFacade(null); assertNull("should be null for null", facadeNull.getDescriptorValue(key)); }