### Question:
PropertyValueParser { public PropertyValue parse(String s){ if (isArrayCandidate(s)){ try { JsonNode jsonNode = MAPPER.readTree(s); if (isArray(jsonNode)){ return policy.handleArray(s, (ArrayNode) jsonNode, this); } else { return stringValue(s); } } catch (JsonProcessingException e) { return stringValue(s); } } else { return stringValue(s); } } PropertyValueParser(PropertyValueParserPolicy policy, String semicolonReplacement, boolean inferType); PropertyValue parse(String s);  }### Answer:
@Test public void shouldDoubleUpDoubleQuotesAndSurroundWithDoubleQuotesAStringValueContainingDoubleQuotes() { String originalValue = "First \"second\" third fourth"; PropertyValue propertyValue = new PropertyValueParser(MultiValuedNodePropertyPolicy.LeaveAsString, "", false).parse(originalValue); assertEquals("\"First \"\"second\"\" third fourth\"", propertyValue.value()); assertFalse(propertyValue.isMultiValued()); }
@Test public void shouldSurroundWithDoubleQuotesAStringValueContainingComma() { String originalValue = "one, two, three"; PropertyValue propertyValue = new PropertyValueParser(MultiValuedNodePropertyPolicy.LeaveAsString, "", false).parse(originalValue); assertEquals("\"one, two, three\"", propertyValue.value()); assertFalse(propertyValue.isMultiValued()); }
@Test public void shouldSurroundWithDoubleQuotesAStringValueContainingNewLine() { String originalValue = "one" + System.lineSeparator() + "two"; PropertyValue propertyValue = new PropertyValueParser(MultiValuedNodePropertyPolicy.LeaveAsString, "", false).parse(originalValue); assertEquals("\"one" + System.lineSeparator() + "two\"", propertyValue.value()); assertFalse(propertyValue.isMultiValued()); }
@Test public void shouldReplaceSemicolonInMultiValuePropertiesWithReplacementString() { String originalValue = "[\"one\",\"two;three\"]"; PropertyValue propertyValue = new PropertyValueParser(MultiValuedNodePropertyPolicy.PutInSetIgnoringDuplicates, "SEMICOLON", false).parse(originalValue); assertEquals("one;twoSEMICOLONthree", propertyValue.value()); assertTrue(propertyValue.isMultiValued()); }