From f2160f4bd1c8ac67e5a86a6710d431e8932877f9 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 28 May 2010 11:47:51 +0000
Subject: [PATCH] Synchronize SDK on java.net with internal repository.
---
sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTestCase.java | 195 ++++++++++++++++++++++++------------------------
1 files changed, 96 insertions(+), 99 deletions(-)
diff --git a/sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTest.java b/sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTestCase.java
similarity index 83%
rename from sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTest.java
rename to sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTestCase.java
index b249090..6a8b34a 100644
--- a/sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTest.java
+++ b/sdk/tests/unit-tests-testng/src/com/sun/opends/sdk/util/StaticUtilsTestCase.java
@@ -34,7 +34,6 @@
import java.util.GregorianCalendar;
import java.util.TimeZone;
-import org.opends.sdk.OpenDSTestCase;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -44,67 +43,8 @@
/**
* Test {@code StaticUtils}.
*/
-@Test(groups = { "precommit", "types", "sdk" }, sequential = true)
-public final class StaticUtilsTest extends OpenDSTestCase
+public final class StaticUtilsTestCase extends UtilTestCase
{
- @DataProvider(name = "dataForToLowerCase")
- public Object[][] dataForToLowerCase()
- {
- // Value, toLowerCase or null if identity
- return new Object[][] {
- { "", null },
- { " ", null },
- { " ", null },
- { "12345", null },
- {
- "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
- null },
- {
- "Aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
- "aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./" },
- {
- "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./A",
- "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./a" },
- { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" },
- { "\u00c7edilla", "\u00e7edilla" },
- { "ced\u00cdlla", "ced\u00edlla" }, };
- }
-
-
-
- @Test(dataProvider = "dataForToLowerCase")
- public void testToLowerCaseString(String s, String expected)
- {
- String actual = StaticUtils.toLowerCase(s);
- if (expected == null)
- {
- Assert.assertSame(actual, s);
- }
- else
- {
- Assert.assertEquals(actual, expected);
- }
- }
-
-
-
- @Test(dataProvider = "dataForToLowerCase")
- public void testToLowerCaseStringBuilder(String s, String expected)
- {
- StringBuilder builder = new StringBuilder();
- String actual = StaticUtils.toLowerCase(s, builder).toString();
- if (expected == null)
- {
- Assert.assertEquals(actual, s);
- }
- else
- {
- Assert.assertEquals(actual, expected);
- }
- }
-
-
-
/**
* Create data for format(...) tests.
*
@@ -156,39 +96,26 @@
- /**
- * Tests {@link StaticUtils#formatAsGeneralizedTime(long)} .
- *
- * @param yyyy
- * The year.
- * @param MM
- * The month.
- * @param dd
- * The day.
- * @param HH
- * The hour.
- * @param mm
- * The minute.
- * @param ss
- * The second.
- * @param SSS
- * The milli-seconds.
- * @param expected
- * The expected generalized time formatted string.
- * @throws Exception
- * If an unexpected error occurred.
- */
- @Test(dataProvider = "createFormatData")
- public void testFormatLong(int yyyy, int MM, int dd, int HH, int mm,
- int ss, int SSS, String expected) throws Exception
+ @DataProvider(name = "dataForToLowerCase")
+ public Object[][] dataForToLowerCase()
{
- Calendar calendar = new GregorianCalendar(TimeZone
- .getTimeZone("UTC"));
- calendar.set(yyyy, MM, dd, HH, mm, ss);
- calendar.set(Calendar.MILLISECOND, SSS);
- long time = calendar.getTimeInMillis();
- String actual = StaticUtils.formatAsGeneralizedTime(time);
- Assert.assertEquals(actual, expected);
+ // Value, toLowerCase or null if identity
+ return new Object[][] {
+ { "", null },
+ { " ", null },
+ { " ", null },
+ { "12345", null },
+ {
+ "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
+ null },
+ {
+ "Aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
+ "aabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./" },
+ {
+ "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./A",
+ "abcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./a" },
+ { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" },
+ { "\u00c7edilla", "\u00e7edilla" }, { "ced\u00cdlla", "ced\u00edlla" }, };
}
@@ -216,15 +143,85 @@
* If an unexpected error occurred.
*/
@Test(dataProvider = "createFormatData")
- public void testFormatDate(int yyyy, int MM, int dd, int HH, int mm,
- int ss, int SSS, String expected) throws Exception
+ public void testFormatDate(final int yyyy, final int MM, final int dd,
+ final int HH, final int mm, final int ss, final int SSS,
+ final String expected) throws Exception
{
- Calendar calendar = new GregorianCalendar(TimeZone
- .getTimeZone("UTC"));
+ final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
calendar.set(yyyy, MM, dd, HH, mm, ss);
calendar.set(Calendar.MILLISECOND, SSS);
- Date time = new Date(calendar.getTimeInMillis());
- String actual = StaticUtils.formatAsGeneralizedTime(time);
+ final Date time = new Date(calendar.getTimeInMillis());
+ final String actual = StaticUtils.formatAsGeneralizedTime(time);
Assert.assertEquals(actual, expected);
}
+
+
+
+ /**
+ * Tests {@link StaticUtils#formatAsGeneralizedTime(long)} .
+ *
+ * @param yyyy
+ * The year.
+ * @param MM
+ * The month.
+ * @param dd
+ * The day.
+ * @param HH
+ * The hour.
+ * @param mm
+ * The minute.
+ * @param ss
+ * The second.
+ * @param SSS
+ * The milli-seconds.
+ * @param expected
+ * The expected generalized time formatted string.
+ * @throws Exception
+ * If an unexpected error occurred.
+ */
+ @Test(dataProvider = "createFormatData")
+ public void testFormatLong(final int yyyy, final int MM, final int dd,
+ final int HH, final int mm, final int ss, final int SSS,
+ final String expected) throws Exception
+ {
+ final Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+ calendar.set(yyyy, MM, dd, HH, mm, ss);
+ calendar.set(Calendar.MILLISECOND, SSS);
+ final long time = calendar.getTimeInMillis();
+ final String actual = StaticUtils.formatAsGeneralizedTime(time);
+ Assert.assertEquals(actual, expected);
+ }
+
+
+
+ @Test(dataProvider = "dataForToLowerCase")
+ public void testToLowerCaseString(final String s, final String expected)
+ {
+ final String actual = StaticUtils.toLowerCase(s);
+ if (expected == null)
+ {
+ Assert.assertSame(actual, s);
+ }
+ else
+ {
+ Assert.assertEquals(actual, expected);
+ }
+ }
+
+
+
+ @Test(dataProvider = "dataForToLowerCase")
+ public void testToLowerCaseStringBuilder(final String s, final String expected)
+ {
+ final StringBuilder builder = new StringBuilder();
+ final String actual = StaticUtils.toLowerCase(s, builder).toString();
+ if (expected == null)
+ {
+ Assert.assertEquals(actual, s);
+ }
+ else
+ {
+ Assert.assertEquals(actual, expected);
+ }
+ }
}
--
Gitblit v1.10.0