### Question:
QuerySettingsParser { protected boolean readBooleanParam(MultivaluedMap<String, String> params, String paramKey) { if (params != null && params.containsKey(paramKey)) { return Boolean.parseBoolean(SearchUtils.trimToNull(params.getFirst(paramKey))); } return false; }  QuerySettings parseUriParams(final MultivaluedMap<String, String> params);  }### Answer:
@Test public void readBooleanParam() { QuerySettingsParser tested = getTested(); Assert.assertFalse(tested.readBooleanParam(null, "key")); MultivaluedMap<String, String> params = new MultivaluedMapImpl<String, String>(); Assert.assertFalse(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", ""); Assert.assertFalse(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", "false"); Assert.assertFalse(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", "False"); Assert.assertFalse(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", "nonsense"); Assert.assertFalse(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", "true"); Assert.assertTrue(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", " True"); Assert.assertTrue(tested.readBooleanParam(params, "key")); params.clear(); params.add("key", "TRUE "); Assert.assertTrue(tested.readBooleanParam(params, "key")); }