SLING-9419 - add stack traces to test failures, to investigate
diff --git a/pom.xml b/pom.xml
index 873a300..5cb2644 100644
--- a/pom.xml
+++ b/pom.xml
@@ -292,5 +292,11 @@
<version>1.0.16</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/RepositoryInitializerTest.java b/src/test/java/org/apache/sling/jcr/repoinit/RepositoryInitializerTest.java
index bbbf605..55b5d26 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/RepositoryInitializerTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/RepositoryInitializerTest.java
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.UUID;
+import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.sling.jcr.api.SlingRepository;
import org.apache.sling.jcr.repoinit.impl.JcrRepoInitOpsProcessorImpl;
import org.apache.sling.jcr.repoinit.impl.RepoinitTextProvider.TextFormat;
@@ -134,14 +135,20 @@
initializer.processRepository(context.getService(SlingRepository.class));
} catch(Exception e) {
if(expectedActivateException != null) {
- assertEquals(expectedActivateException, e.getClass());
+ assertEquals(
+ "Expecting a " + expectedActivateException.getName() + " but got " + withStackTrace(e),
+ expectedActivateException, e.getClass());
} else {
- fail("Got unexpected " + e.getClass().getName() + " in activation");
+ fail("Unexpected Exception in activation: " + withStackTrace(e));
}
}
}
+ public static String withStackTrace(Throwable t) {
+ return t.toString() + "\n" + ExceptionUtils.getStackTrace(t);
+ }
+
@Test
public void testLogin() throws Exception {
if(testLogin) {