### Question:
ParamUtilities extends Static { public static String writeParameterJSON(GeneralParameterValue parameter) throws JsonProcessingException { ArgumentChecks.ensureNonNull("parameter", parameter); final ObjectMapper mapper = new ObjectMapper(); final SimpleModule module = new SimpleModule(); module.addSerializer(GeneralParameterValue.class, new ParameterValueJSONSerializer()); mapper.registerModule(module); return mapper.writeValueAsString(parameter); }  static GeneralParameterValue readParameter(final InputStream stream,
                                                      final ParameterDescriptorGroup descriptor); static GeneralParameterValue readParameter(final InputStream stream,
                                                      final GeneralParameterDescriptor descriptor); static GeneralParameterValue readParameter(final String xml,
                                                      final GeneralParameterDescriptor descriptor); static String readString(final InputStream stream); static String writeParameter(final GeneralParameterValue parameter); static String writeParameterJSON(GeneralParameterValue parameter); static GeneralParameterValue readParameterJSON(String inputJson, GeneralParameterDescriptor descriptor); static String writeParameterDescriptorJSON(GeneralParameterDescriptor descriptor);  }### Answer:
@Test public void testSerializeParameterGroupJSON() throws JsonProcessingException { String jsonValue = ParamUtilities.writeParameterJSON(VALUE); String expectedJSON = "{\"strParam\":[\"AString\"],\"boolParam\":[false],\"objParam\":[{\"id\":1,\"name\":\"constellation\"}]," + "\"intParam\":[55],\"enumParam\":[\"TWO\"]," + "\"subgroup\":[{\"doubleParam\":[0.5]},{\"doubleParam\":[55.74]},{\"doubleParam\":[66.1]}]}"; Assert.assertNotNull(jsonValue); Assert.assertEquals(expectedJSON, jsonValue); try { ParamUtilities.writeParameterJSON(null); Assert.fail("writeParameterJSON(null) should fail."); } catch (NullArgumentException ex) { } }
@Test public void testSerializeParameterValueJSON() throws JsonProcessingException { ParameterValue strParam = VALUE.parameter("strParam"); String jsonValue = ParamUtilities.writeParameterJSON(strParam); String expectedJSON = "{\"strParam\":[\"AString\"]}"; Assert.assertNotNull(jsonValue); Assert.assertEquals(expectedJSON, jsonValue); }