From 60f5dfd7eaa64aa931033c0e5266391ecbbc96fa Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Wed, 25 Sep 2013 07:31:13 +0000
Subject: [PATCH] Fix OPENDJ-18 - keystore import failes due to empty PIN Review CR-2353

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestStaticUtils.java |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestStaticUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestStaticUtils.java
index fccde2c..af075c2 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestStaticUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestStaticUtils.java
@@ -23,7 +23,7 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2011 ForgeRock AS
+ *      Portions Copyright 2013 ForgeRock AS
  */
 package org.opends.server.util;
 
@@ -1194,4 +1194,17 @@
       throws Exception {
     Assert.assertEquals(StaticUtils.listsAreEqual(list1, list2), result);
   }
+
+  @Test
+  public void testStackTraceHasCause() throws Exception
+  {
+    boolean hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new ArithmeticException()), ArithmeticException.class);
+    Assert.assertTrue(hasCause, "First case : ArithmeticException should be detected as a cause");
+
+    hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new RuntimeException()), ArithmeticException.class);
+    Assert.assertFalse(hasCause, "Second case : ArithmeticException should not be detected as a cause");
+
+    hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new IllegalThreadStateException()), IllegalArgumentException.class);
+    Assert.assertTrue(hasCause, "Third case : IllegalThreadStateException should be detected as a cause");
+  }
 }

--
Gitblit v1.10.0