+ @Test
+ public void testMisBehavingDocumentType() {
+ DocumentType type = mock(DocumentType.class);
+ doThrow(new RuntimeException("x")).when(type).isInstance(
+ any(DOMSource.class));
+ router.getDocumentTypeConfig().add(type);
+ router.publish("xx", mock(DOMSource.class));
+ verify(listener).notDelivered(any(EventInfo.class));
+ // no exception should occur.
+ }
+
+ @Test
+ public void testMisBehavingFilter() {
+ registerDocumentType("any");
+ Filter filter = mock(Filter.class);
+ doThrow(new RuntimeException("x")).when(filter).isAllowed(anyString(),
+ any(DOMSource.class));
+ router.getFilterConfig().add(filter);
+ router.publish("xx", mock(DOMSource.class));
+ verify(listener).notDelivered(any(EventInfo.class));
+ // no exception should occur.
+ }
+