@Test public void testListChanges() { assertThat(attributes.get("mylist"), is(nullValue())); assertTrue(applyAttributeChange(attributes, APPEND, "mylist", 2)); assertThat((List<?>) attributes.get("mylist"), contains(2)); assertTrue(applyAttributeChange(attributes, PREPEND, "mylist", 3)); assertThat((List<?>) attributes.get("mylist"), contains(3, 2)); assertTrue(applyAttributeChange(attributes, APPEND, "mylist", 1)); assertThat((List<?>) attributes.get("mylist"), contains(3, 2, 1)); try { applyAttributeChange(attributes, APPEND, "notalist", 1); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Cannot append to non-list attribute")); } try { applyAttributeChange(attributes, PREPEND, "notalist", 1); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Cannot prepend to non-list attribute")); } }
public static boolean applyAttributeChange( final RepositoryContent content, final AttributeChange change, final String key, @Nullable final Object value) { return applyAttributeChange(content.attributes(), change, key, value); }
AttributesHelper { public static boolean applyAttributeChange( final RepositoryContent content, final AttributeChange change, final String key, @Nullable final Object value) { return applyAttributeChange(content.attributes(), change, key, value); } }
AttributesHelper { public static boolean applyAttributeChange( final RepositoryContent content, final AttributeChange change, final String key, @Nullable final Object value) { return applyAttributeChange(content.attributes(), change, key, value); } private  AttributesHelper(); }
AttributesHelper { public static boolean applyAttributeChange( final RepositoryContent content, final AttributeChange change, final String key, @Nullable final Object value) { return applyAttributeChange(content.attributes(), change, key, value); } private  AttributesHelper(); static boolean applyAttributeChange(
      final RepositoryContent content,
      final AttributeChange change,
      final String key,
      @Nullable final Object value); static boolean applyAttributeChange(
      final AttributesMap attributes,
      final AttributeChange change,
      final String key,
      @Nullable final Object value); }
AttributesHelper { public static boolean applyAttributeChange( final RepositoryContent content, final AttributeChange change, final String key, @Nullable final Object value) { return applyAttributeChange(content.attributes(), change, key, value); } private  AttributesHelper(); static boolean applyAttributeChange(
      final RepositoryContent content,
      final AttributeChange change,
      final String key,
      @Nullable final Object value); static boolean applyAttributeChange(
      final AttributesMap attributes,
      final AttributeChange change,
      final String key,
      @Nullable final Object value);  }