### Question:
ProjectValidationResultSliElParam extends ProjectValidationResultParam { public Map<String, String> asMap() { if (ids == null) { return null; } if (vals == null) { throw new IllegalStateException("Values not defined for IDs."); } if (ids.size() != vals.size()) { throw new IllegalStateException(format("Size of list of IDs (%s) and corresponding list of their values (%s)" + " is not equal.", ids.size(), vals.size())); } final Map<String, String> sliElParamMap = new LinkedHashMap<>(ids.size()); for (int index = 0; index < ids.size(); index++) { sliElParamMap.put(ids.get(index), vals.get(index)); } return sliElParamMap; } ProjectValidationResultSliElParam(final List<String> ids, final List<String> vals); List<String> getIds(); List<String> getVals(); Map<String, String> asMap(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testAsMapNullIds() throws Exception { final ProjectValidationResultSliElParam param = new ProjectValidationResultSliElParam(null, singletonList("2")); assertThat(param.asMap(), nullValue()); }
@Test(expectedExceptions = IllegalStateException.class) public void testAsMapNullVals() throws Exception { new ProjectValidationResultSliElParam(singletonList("2"), null).asMap(); }
@Test(expectedExceptions = IllegalStateException.class) public void testAsMapNotEqualIdsVals() throws Exception { new ProjectValidationResultSliElParam(asList("2", "1"), singletonList("1234")).asMap(); }
@Test public void testAsMap() throws Exception { final ProjectValidationResultSliElParam param = new ProjectValidationResultSliElParam(asList("1", "3", "2"), asList("1234", "9012", "5678")); final Map<String, String> expectedMap = new HashMap<>(3); expectedMap.put("1", "1234"); expectedMap.put("2", "5678"); expectedMap.put("3", "9012"); assertThat(param.asMap(), is(expectedMap)); }