### Question:
StringUtil { public static String arrayToJson(String[] array) { if (null == array) {return EMPTY_JSON_ARRAY;} StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); try { jsonWriter.array(); for (String item: array) { jsonWriter.value(item); } jsonWriter.endArray(); } catch (JSONException e) { LOG.error("Can't convert array '{}' to JSON", array, e); return EMPTY_JSON_ARRAY; } return stringWriter.toString(); }  static String arrayToJson(String[] array); static final String[] EMPTY_STRING_ARRAY; static final String EMPTY_JSON_ARRAY; }### Answer:
@Test public void testArrayToJsonWithEmptyArray() { assertEquals("[]", StringUtil.arrayToJson(new String[]{})); }
@Test public void testArrayToJsonWithNull() { assertEquals("[]", StringUtil.arrayToJson(null)); }
@Test public void testArrayToJsonWithValid() { assertEquals("[\"item1\",\"item2\"]", StringUtil.arrayToJson(new String[]{"item1","item2"})); }