DatatypeLibraryImpl implements DatatypeLibrary { public Datatype createDatatype(String type) throws DatatypeException { return createDatatypeBuilder(type).createDatatype(); } DatatypeLibraryImpl(RegexEngine regexEngine); DatatypeBuilder createDatatypeBuilder(String localName); Datatype createDatatype(String type);  }
@Test public void testCreateDatatype() throws DatatypeException { Datatype dt = lib.createDatatype("integer"); try { dt.checkValid("foo", null); } catch (DatatypeException e) { String message = e.getMessage(); Assert.assertNotNull(message); Assert.assertTrue(message.contains("integer")); } }