/** * Verifies that if the DocumentBuilderFactory throws a configuration error from {@code * newInstance}, the supplier from the logging module will return {@code null}. */ @Test public void testDocumentBuilderFactoryNewInstanceConfigError_returnsNull() { MockDocumentBuilderFactory.isThrowInConstructor = true; LoggingModule.DocumentBuilderSupplier supplier = new DocumentBuilderSupplier(); DocumentBuilder builder = supplier.get(); assertNull("Supplier should have returned null when a configuration error is thrown", builder); }
/** * Verifies that if the DocumentBuilderFactory throws a configuration exception from {@code * newDocumentBuilder}, the supplier from the logging module will return {@code null}. */ @Test public void testDocumentBuilderFactoryNewDocumentBuilderConfigException_returnsNull() { MockDocumentBuilderFactory.isThrowInNewDocumentBuilder = true; LoggingModule.DocumentBuilderSupplier supplier = new DocumentBuilderSupplier(); DocumentBuilder builder = supplier.get(); assertNull( "Supplier should have returned null when a configuration exception is thrown", builder); }