### Question:
InputParamUtil { public static String getOptionalParam(Map<String, String> parameters, String parameterKey, String defaultValue) { if (parameters == null || parameters.get(parameterKey) == null || parameters.get(parameterKey).trim().isEmpty()) { return defaultValue; } else { return parameters.get(parameterKey); } }  static String getRequiredParam(Map<String, String> parameters, String parameterKey); static String getOptionalParam(Map<String, String> parameters, String parameterKey, String defaultValue); static String getOptionalParam(Map<String, String> parameters, String parameterKey); static boolean getOptionalBooleanParam(Map<String, String> parameters, String paramKey); static boolean getOptionalBooleanParam(Map<String, String> parameters, String paramKey, String defaultValue);  }### Answer:
@Test public void testGetOptionalParamWherePresent() { Map<String, String> params = new HashMap<String, String>(){{ put("paramKey", "paramValue"); }}; assertEquals("paramValue", InputParamUtil.getOptionalParam(params, "paramKey")); }
@Test public void testGetOptionalParamWhereNotPresent() { Map<String, String> params = new HashMap<String, String>(){{ }}; assertNull(InputParamUtil.getOptionalParam(params, "paramKey")); }