DefaultAttributeMap { @Nullable @SuppressWarnings("unchecked") <T> T setAttr(AttributeKey<T> key, @Nullable T value) { return (T) setAttr(key, value, SetAttrMode.OLD_VALUE); } DefaultAttributeMap(@Nullable RequestContext rootAttributeMap); @Override String toString();  }
@Test void testIteratorWithFullMap() { final DefaultAttributeMap map = new DefaultAttributeMap(null); final List<AttributeKey<Integer>> expectedKeys = new ArrayList<>(); for (int i = 0; i < 1024; i++) { final AttributeKey<Integer> key = AttributeKey.valueOf(DefaultAttributeMapTest.class, String.valueOf(i)); expectedKeys.add(key); assertThat(map.setAttr(key, i)).isNull(); } for (int i = 0; i < map.attributes.length(); i++) { assertThat(map.attributes.get(i)).isNotNull(); } assertThat(expectedKeys).isEqualTo(actualKeys(map)); for (int i = 1023; i >= 0; i -= 5) { final AttributeKey<Integer> key = expectedKeys.get(i); assertThat(map.setAttr(key, null)).isEqualTo(i); expectedKeys.remove(i); } assertThat(expectedKeys).isEqualTo(actualKeys(map)); }