PermissionSubjectsMap extends AbstractMap<String, Map<String, Integer>> { @Override public Map<String, Integer> put(final String key, final Map<String, Integer> value) { return data.put(checkNotNull(key, "key"), checkNotNull(value, "value")); } PermissionSubjectsMap(); @Override Set<Entry<String, Map<String, Integer>>> entrySet(); @Override Map<String, Integer> put(final String key, final Map<String, Integer> value); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void putReturnsNullForNewAssociation() { final Map<String, Integer> oldValue = underTest.put("READ", Collections.singletonMap(subjectId, 0)); assertThat(oldValue).isNull(); }
@Test public void putReturnsOldValueForNewAssociation() { final String permission = "READ"; final Map<String, Integer> weightedSubjectId = Collections.singletonMap(subjectId, 0); underTest.put(permission, weightedSubjectId); final Map<String, Integer> oldValue = underTest.put(permission, Collections.singletonMap(subjectId, 1)); assertThat(oldValue).isEqualTo(weightedSubjectId); }