AbstractCredentials implements Credentials { @NotNull public Map<String,Object> getAttributes() { return Collections.unmodifiableMap(attributes); } AbstractCredentials(@NotNull String userId); @NotNull String getUserId(); void setAttribute(@NotNull String name, @Nullable Object value); @Nullable Object getAttribute(@NotNull String name); void removeAttribute(@NotNull String name); @NotNull Map<String,Object> getAttributes(); void setAttributes(@NotNull Map<String,Object> attributes);  }
@Test public void testAttributesAreEmpty() { assertTrue(credentials.getAttributes().isEmpty()); }
@Test(expected = UnsupportedOperationException.class) public void testAttributesAreImmutable() { credentials.getAttributes().put("attr", "value"); }