AbstractCredentials implements Credentials { public void setAttributes(@NotNull Map<String,Object> attributes) { synchronized (this.attributes) { this.attributes.putAll(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 testSetAttributes() { Map<String,Object> attributes = ImmutableMap.of("attr", true); credentials.setAttributes(attributes); Map<String,Object> attr = credentials.getAttributes(); assertFalse(attr.isEmpty()); assertEquals(attributes, attr); assertNotSame(attributes, attr); }