/** * Add a library and sets it as the default * * @param uri the value for {@code $schema} * @param library the library * @return this * @see #addLibrary(String, Library) */ public ValidationConfigurationBuilder setDefaultLibrary(final String uri, final Library library) { addLibrary(uri, library); defaultLibrary = library; return this; }
@Test public void cannotPutNullLibrary() { final String ref = "x://y.z/schema#"; try { cfg.addLibrary(ref, null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getMessage("nullLibrary")); } }
@Test public void cannotOverrideExistingLibrary() { final String ref = "x://y.z/schema#"; final Library library = Library.newBuilder().freeze(); try { cfg.addLibrary(ref, library); cfg.addLibrary(ref, library); fail("No exception thrown!!"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(),BUNDLE.printf("dupLibrary", ref)); } }