PermissionSubjectsMap extends AbstractMap<String, Map<String, Integer>> { PermissionSubjectsMap addAllEntriesFrom(final PermissionSubjectsMap other) { checkNotNull(other, "relation to be added"); other.forEach(this::addPermissionSubjects); return this; } 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();  }
@SuppressWarnings("ConstantConditions") @Test public void tryToAddAllEntriesFromNull() { assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> underTest.addAllEntriesFrom(null)) .withMessage("The %s must not be null!", "relation to be added") .withNoCause(); }
@Test public void addAllEntriesFromEmptyMapReturnsSame() { final PermissionSubjectsMap permissionSubjectsMap = underTest.addAllEntriesFrom(new PermissionSubjectsMap()); assertThat(permissionSubjectsMap) .isSameAs(underTest) .isEmpty(); }