RepositoryFacade implements Repository { @Override public String[] getDescriptorKeys() { return delegate != null ? delegate.getDescriptorKeys() : new String[0]; } @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 testDescriptorKeys() { final Repository mockRepository = mock(Repository.class); final String[] keys = new String[]{"SOME_KEY"}; when(mockRepository.getDescriptorKeys()).thenReturn(keys); final RepositoryFacade facade = getFacade(mockRepository); assertSame("should be same descriptorKeys", keys, facade.getDescriptorKeys()); final RepositoryFacade facadeNull = getFacade(null); assertEquals("should be empty", 0, facadeNull.getDescriptorKeys().length); }