X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2Fosgi%2FTestingExceptionHandler.java;h=3f04010015e8291d8dbeb6e47415d6ab8a12ad3f;hb=c46e223995956f1f759c551163c212947c1e2fb7;hp=d42c15b8342736b0a523a7723d2e1d3b7865b15a;hpb=4b5f54e25c08fc21c955ff75901abe96b12d3340;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java b/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java index d42c15b834..3f04010015 100644 --- a/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java +++ b/opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java @@ -7,23 +7,32 @@ */ package org.opendaylight.controller.netconf.persist.impl.osgi; -import org.junit.matchers.JUnitMatchers; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; +import org.junit.matchers.JUnitMatchers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + final class TestingExceptionHandler implements Thread.UncaughtExceptionHandler { + private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterTest.class); + private Throwable t; @Override public void uncaughtException(Thread t, Throwable e) { + logger.debug("Uncaught exception in thread {}", t, e); this.t = e; } + public void assertException(Class exType, String exMessageToContain) { + assertException(exMessageToContain, exType, exMessageToContain); + } + public void assertException(String failMessageSuffix, Class exType, String exMessageToContain) { if(t == null) { fail("Should fail to " + failMessageSuffix);