ResultSetMappingManager { public void addMapper(String mappingName, SparqlResultMapper mapper) { Objects.requireNonNull(mappingName); Objects.requireNonNull(mapper); if (mappers.containsKey(mappingName)) { throw new IllegalArgumentException("Mapping " + mappingName + " already exists in this persistence unit."); } mappers.put(mappingName, mapper); }  void addMapper(String mappingName, SparqlResultMapper mapper); SparqlResultMapper getMapper(String mappingName);  }
@Test public void addMapperThrowsIllegalArgumentWhenMapperForSpecifiedNameAlreadyExists() { final SparqlResultMapper mapper = new ResultRowMapper(NAME); manager.addMapper(NAME, mapper); thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Mapping " + NAME + " already exists in this persistence unit."); manager.addMapper(NAME, new ResultRowMapper(NAME)); }