### Question:
SingleQueryParameterUtils { public static String validateQueryParameter( final Map<String, List<String>> parameterMap, final String key) throws IllegalArgumentException { if (parameterMap.containsKey(key)) { if (parameterMap.get(key).size() != 1) { throw new IllegalArgumentException(String.format(MUST_SPECIFY_ONLY_ONCE, key)); } if (!StringUtils.isEmpty(parameterMap.get(key).get(0))) { return parameterMap.get(key).get(0); } } throw new IllegalArgumentException(String.format(NULL_OR_EMPTY_FORMAT, key)); }  static String validateQueryParameter(
      final Map<String, List<String>> parameterMap, final String key); static int getParameterValueAsInt(
      final Map<String, List<String>> parameterMap, final String key); static UInt64 getParameterValueAsUInt64(
      final Map<String, List<String>> parameterMap, final String key); static UInt64 getParameterValueAsEpoch(
      final Map<String, List<String>> parameterMap, final String key); static long getParameterValueAsLong(
      final Map<String, List<String>> parameterMap, final String key); static Bytes32 getParameterValueAsBytes32(
      final Map<String, List<String>> parameterMap, final String key); static BLSSignature getParameterValueAsBLSSignature(
      final Map<String, List<String>> parameterMap, final String key); static final String INVALID_BYTES32_DATA; static final String INVALID_BYTES96_DATA; static final String INVALID_NUMERIC_VALUE; static final String NULL_OR_EMPTY_FORMAT; static final String MUST_SPECIFY_ONLY_ONCE; }### Answer:
@Test public void validateParameters_shouldDetectMissingKey() { Map<String, List<String>> data = Map.of(); assertThrows(IllegalArgumentException.class, () -> validateQueryParameter(data, KEY)); }
@Test public void validateParameters_shouldDetectEmptyString() { Map<String, List<String>> data = Map.of(KEY, List.of()); assertThrows(IllegalArgumentException.class, () -> validateQueryParameter(data, KEY)); }
@Test public void validateParameters_shouldDetectMultipleEntries() { Map<String, List<String>> data = Map.of(KEY, List.of("1", "2")); assertThrows(IllegalArgumentException.class, () -> validateQueryParameter(data, KEY)); }
@Test public void validateParameters_shouldReturnValue() { Map<String, List<String>> data = Map.of(KEY, List.of(VALUE)); assertEquals(VALUE, validateQueryParameter(data, KEY)); }