RepositoryFacade implements Repository { @Override public Value[] getDescriptorValues(String key) { return delegate != null ? delegate.getDescriptorValues(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 testGetDescriptorValues() { final Repository mockRepository = mock(Repository.class); final String key = "SOME_KEY"; final Value[] values = new Value[]{new SimpleValueFactory().createValue("SOME_VALUE")}; when(mockRepository.getDescriptorValues(anyString())).thenReturn(null); when(mockRepository.getDescriptorValues(key)).thenReturn(values); final RepositoryFacade facade = getFacade(mockRepository); assertSame("should be same values", values, facade.getDescriptorValues(key)); assertNull("should be null", facade.getDescriptorValues("")); final RepositoryFacade facadeNull = getFacade(null); assertNull("should be null for null", facadeNull.getDescriptorValues(key)); }