JsonConverter extends AbstractConfigurationConverter { JsonValue readJsonArrayFromValue(final String key, final @Nullable Object value) throws ComponentConfigurationException { if (value instanceof JsonArray) { return (JsonArray) value; } else if (value instanceof String) { try (JsonReader reader = Json.createReader(new StringReader((String) value))) { return reader.readArray(); } catch (JsonException e) { throw new ComponentConfigurationException("Failed to parse value for key " + key + " as JsonArray.", e); } } return JsonObject.NULL; }  static String plexusPluralStem(final String key); @Override boolean canConvert(final Class<?> type); @Override Object fromConfiguration(final ConverterLookup lookup,
                                    final PlexusConfiguration configuration,
                                    final Class<?> type,
                                    final Class<?> enclosingType,
                                    final ClassLoader loader,
                                    final ExpressionEvaluator evaluator,
                                    final ConfigurationListener listener); JsonValue convertChild(final @NotNull PlexusConfiguration child, final ExpressionEvaluator evaluator); static Object stringToValue(String string);  }
@Test public void testReadJsonArrayFromValue() throws Exception { final JsonArray expectSameArray = arr("one", "two", "three").get(); assertSame("same json array", expectSameArray, converter().readJsonArrayFromValue("key", expectSameArray)); assertSame("null value is JsonValue.NULL", JsonValue.NULL, converter().readJsonArrayFromValue("key", null)); assertEquals("json array as string is equal", expectSameArray, converter().readJsonArrayFromValue("key", expectSameArray.toString())); }
@Test(expected = ComponentConfigurationException.class) public void testReadJsonArrayFromValue_throws() throws Exception { converter().readJsonArrayFromValue("key", "some string"); }