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/org/opends/sdk/schema/OrderingMatchingRuleTest.java | 83 ++++++++++++++++++++---------------------
1 files changed, 41 insertions(+), 42 deletions(-)
diff --git a/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/OrderingMatchingRuleTest.java b/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/OrderingMatchingRuleTest.java
index 53444ff..cd8eba9 100644
--- a/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/OrderingMatchingRuleTest.java
+++ b/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/OrderingMatchingRuleTest.java
@@ -29,14 +29,13 @@
import org.opends.sdk.Assertion;
+import org.opends.sdk.ByteString;
import org.opends.sdk.ConditionResult;
import org.opends.sdk.DecodeException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import org.opends.sdk.ByteString;
-
/**
@@ -45,8 +44,18 @@
public abstract class OrderingMatchingRuleTest extends SchemaTestCase
{
/**
+ * Create data for the OrderingMatchingRulesInvalidValues test.
+ *
+ * @return The data for the OrderingMatchingRulesInvalidValues test.
+ */
+ @DataProvider(name = "OrderingMatchingRuleInvalidValues")
+ public abstract Object[][] createOrderingMatchingRuleInvalidValues();
+
+
+
+ /**
* Create data for the OrderingMatchingRules test.
- *
+ *
* @return The data for the OrderingMatchingRules test.
*/
@DataProvider(name = "Orderingmatchingrules")
@@ -58,39 +67,39 @@
* Test the comparison of valid values.
*/
@Test(dataProvider = "Orderingmatchingrules")
- public void OrderingMatchingRules(String value1, String value2,
- int result) throws Exception
+ public void orderingMatchingRules(final String value1, final String value2,
+ final int result) throws Exception
{
// Make sure that the specified class can be instantiated as a task.
- MatchingRule ruleInstance = getRule();
+ final MatchingRule ruleInstance = getRule();
- ByteString normalizedValue1 =
- ruleInstance
- .normalizeAttributeValue(ByteString.valueOf(value1));
- ByteString normalizedValue2 =
- ruleInstance
- .normalizeAttributeValue(ByteString.valueOf(value2));
+ final ByteString normalizedValue1 = ruleInstance
+ .normalizeAttributeValue(ByteString.valueOf(value1));
+ final ByteString normalizedValue2 = ruleInstance
+ .normalizeAttributeValue(ByteString.valueOf(value2));
// Test the comparator
- int comp =
- ruleInstance.comparator().compare(normalizedValue1,
- normalizedValue2);
+ final int comp = ruleInstance.comparator().compare(normalizedValue1,
+ normalizedValue2);
if (comp == 0)
+ {
Assert.assertEquals(comp, result);
+ }
else if (comp > 0)
+ {
Assert.assertTrue(result > 0);
+ }
else if (comp < 0)
+ {
Assert.assertTrue(result < 0);
+ }
- Assertion a =
- ruleInstance.getGreaterOrEqualAssertion(ByteString
- .valueOf(value2));
+ Assertion a = ruleInstance.getGreaterOrEqualAssertion(ByteString
+ .valueOf(value2));
Assert.assertEquals(a.matches(normalizedValue1),
result >= 0 ? ConditionResult.TRUE : ConditionResult.FALSE);
- a =
- ruleInstance
- .getLessOrEqualAssertion(ByteString.valueOf(value2));
+ a = ruleInstance.getLessOrEqualAssertion(ByteString.valueOf(value2));
Assert.assertEquals(a.matches(normalizedValue1),
result <= 0 ? ConditionResult.TRUE : ConditionResult.FALSE);
@@ -102,35 +111,25 @@
/**
- * Get the Ordering matching Rules that is to be tested.
- *
- * @return The Ordering matching Rules that is to be tested.
- */
- protected abstract MatchingRule getRule();
-
-
-
- /**
- * Create data for the OrderingMatchingRulesInvalidValues test.
- *
- * @return The data for the OrderingMatchingRulesInvalidValues test.
- */
- @DataProvider(name = "OrderingMatchingRuleInvalidValues")
- public abstract Object[][] createOrderingMatchingRuleInvalidValues();
-
-
-
- /**
* Test that invalid values are rejected.
*/
@Test(expectedExceptions = DecodeException.class, dataProvider = "OrderingMatchingRuleInvalidValues")
- public void OrderingMatchingRulesInvalidValues(String value)
+ public void orderingMatchingRulesInvalidValues(final String value)
throws Exception
{
// Make sure that the specified class can be instantiated as a task.
- MatchingRule ruleInstance = getRule();
+ final MatchingRule ruleInstance = getRule();
// normalize the 2 provided values
ruleInstance.normalizeAttributeValue(ByteString.valueOf(value));
}
+
+
+
+ /**
+ * Get the Ordering matching Rules that is to be tested.
+ *
+ * @return The Ordering matching Rules that is to be tested.
+ */
+ protected abstract MatchingRule getRule();
}
--
Gitblit v1.10.0