Converter { static Converter createDefaultConverter() { List<NodeFactory> factories; String property = System.getProperty(LIBRARIES_PROPERTY_NAME); if (property != null && property.trim().length() > 0) { factories = createFactoriesSpecifiedInProperty(property); } else { factories = createDefaultFactories(); } if (factories.isEmpty()) { throw new IllegalStateException("Please add either json.org, Jackson 1.x, Jackson 2.x, Johnzon or Gson to the classpath"); } return new Converter(factories); } Converter(List<NodeFactory> factories);   }
@Test void shouldFailOnUnknownFactory() { System.setProperty(LIBRARIES_PROPERTY_NAME,"unknown"); try { Converter.createDefaultConverter(); fail("Exception expected"); } catch (IllegalArgumentException e) { assertThat(e.getMessage()).isEqualTo("'unknown' library name not recognized."); } finally { System.setProperty(LIBRARIES_PROPERTY_NAME, ""); } }