@Test public void testGetDescriptor() { final Repository mockRepository = mock(Repository.class); final String key = "SOME_KEY"; final String value = "SOME_VALUE"; when(mockRepository.getDescriptor(anyString())).thenReturn(null); when(mockRepository.getDescriptor(key)).thenReturn(value); final RepositoryFacade facade = getFacade(mockRepository); assertSame("should be same value", value, facade.getDescriptor(key)); assertNull("should be null", facade.getDescriptor("")); final RepositoryFacade facadeNull = getFacade(null); assertNull("should be null for null", facadeNull.getDescriptor(key)); }
@Override public String getDescriptor(String key) { return delegate != null ? delegate.getDescriptor(key) : null; }
RepositoryFacade implements Repository { @Override public String getDescriptor(String key) { return delegate != null ? delegate.getDescriptor(key) : null; } }
RepositoryFacade implements Repository { @Override public String getDescriptor(String key) { return delegate != null ? delegate.getDescriptor(key) : null; } @SuppressWarnings("WeakerAccess")  RepositoryFacade(final @Nullable Repository delegate); }
RepositoryFacade implements Repository { @Override public String getDescriptor(String key) { return delegate != null ? delegate.getDescriptor(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(); }
RepositoryFacade implements Repository { @Override public String getDescriptor(String key) { return delegate != null ? delegate.getDescriptor(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();  }