From f78f372a776579b6c2fb0a0bbb77b098a535aa20 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 29 Apr 2016 13:10:39 +0000
Subject: [PATCH] unit tests: removed some additional suppressions (compared to forgerock-build-tools equivalent file)
---
opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java | 54 +++++++++++++++++++++---------------------------------
1 files changed, 21 insertions(+), 33 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java b/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
index 1601842..13d3eb5 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/util/TestStaticUtils.java
@@ -33,7 +33,6 @@
import java.util.LinkedList;
import java.util.List;
-import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.TestCaseUtils;
import org.testng.Assert;
@@ -45,6 +44,7 @@
* This class defines a set of tests for the
* {@link org.opends.server.util.StaticUtils} class.
*/
+@SuppressWarnings("javadoc")
public final class TestStaticUtils extends UtilTestCase {
/** Lower case hex digit lookup table. */
private static final char[] HEX_DIGITS_LOWER = new char[] { '0', '1',
@@ -579,7 +579,7 @@
}
/**
- * Tests the {@link StaticUtils#needsBase64Encoding(ByteSequence)} method.
+ * Tests the {@link StaticUtils#needsBase64Encoding(org.forgerock.opendj.ldap.ByteSequence)} method.
*
* @param s
* The test string.
@@ -606,17 +606,10 @@
public void testMoveFileNonExistentSrc() throws Exception {
File src = File.createTempFile("src", null);
File dst = TestCaseUtils.createTemporaryDirectory("dst");
- File newSrc = new File(dst, src.getName());
src.delete();
- try {
- StaticUtils.moveFile(src, dst);
- } finally {
- src.delete();
- dst.delete();
- newSrc.delete();
- }
+ moveFile(src, dst);
}
/**
@@ -630,17 +623,10 @@
public void testMoveFileNonExistentDst() throws Exception {
File src = File.createTempFile("src", null);
File dst = TestCaseUtils.createTemporaryDirectory("dst");
- File newSrc = new File(dst, src.getName());
dst.delete();
- try {
- StaticUtils.moveFile(src, dst);
- } finally {
- src.delete();
- dst.delete();
- newSrc.delete();
- }
+ moveFile(src, dst);
}
/**
@@ -654,15 +640,8 @@
public void testMoveFileSrcNotFile() throws Exception {
File src = TestCaseUtils.createTemporaryDirectory("src");
File dst = TestCaseUtils.createTemporaryDirectory("dst");
- File newSrc = new File(dst, src.getName());
- try {
- StaticUtils.moveFile(src, dst);
- } finally {
- src.delete();
- dst.delete();
- newSrc.delete();
- }
+ moveFile(src, dst);
}
/**
@@ -676,8 +655,13 @@
public void testMoveFileDstNotDirectory() throws Exception {
File src = File.createTempFile("src", null);
File dst = File.createTempFile("dst", null);
- File newSrc = new File(dst, src.getName());
+ moveFile(src, dst);
+ }
+
+ private void moveFile(File src, File dst) throws IOException
+ {
+ File newSrc = new File(dst, src.getName());
try {
StaticUtils.moveFile(src, dst);
} finally {
@@ -915,7 +899,7 @@
/**
* Tests the
- * {@link StaticUtils#toLowerCase(ByteSequence, StringBuilder, boolean)}
+ * {@link StaticUtils#toLowerCase(org.forgerock.opendj.ldap.ByteSequence, StringBuilder, boolean)}
* method.
*
* @param input
@@ -978,8 +962,9 @@
}
/**
- * Create test strings for the {@link StaticUtils#toLowerCase(ByteSequence, StringBuilder, boolean)} method
- * with trimming enabled.
+ * Create test strings for the
+ * {@link StaticUtils#toLowerCase(org.forgerock.opendj.ldap.ByteSequence, StringBuilder, boolean)}
+ * method with trimming enabled.
*
* @return Returns an array of test data.
*/
@@ -1049,13 +1034,16 @@
@Test
public void testStackTraceHasCause() throws Exception
{
- boolean hasCause = StaticUtils.stackTraceContainsCause(new RuntimeException(new ArithmeticException()), ArithmeticException.class);
+ 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);
+ 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);
+ 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