From a26ed3e6010501ad69c394b5778cb4f5770d43ad Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 15 Sep 2006 15:28:54 +0000
Subject: [PATCH] Some more unit tests for the schema package
---
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/ApproximatematchingRule.java | 23 +++++++----------------
1 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/ApproximatematchingRule.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/ApproximatematchingRule.java
index ac0e4cb..3fc113f 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/ApproximatematchingRule.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/ApproximatematchingRule.java
@@ -26,18 +26,19 @@
*/
package org.opends.server.schema;
-import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.*;
-import org.opends.server.TestCaseUtils;
import org.opends.server.api.ApproximateMatchingRule;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.types.ByteString;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class ApproximatematchingRule extends SchemaTestCase
{
+ /**
+ * Build the data for the approximateMatchingRules test.
+ */
@DataProvider(name="approximatematchingrules")
public Object[][] createapproximateMatchingRuleTest()
{
@@ -136,6 +137,7 @@
{
// load the mathing rule code
Class rule = Class.forName("org.opends.server.schema."+ruleClassName);
+ assertNotNull(rule);
// Make sure that the specified class can be instantiated as a task.
ApproximateMatchingRule ruleInstance =
@@ -145,26 +147,15 @@
// moment.
// ruleInstance.initializeMatchingRule(configEntry);
- // normalize the 2 provided values and check that they are equals
+ // normalize the 2 provided values
ByteString normalizedValue1 =
ruleInstance.normalizeValue(new ASN1OctetString(value1));
ByteString normalizedValue2 =
ruleInstance.normalizeValue(new ASN1OctetString(value2));
+ // check that the approximatelyMatch return the expected result.
Boolean liveResult = ruleInstance.approximatelyMatch(normalizedValue1,
normalizedValue2);
assertEquals(result, liveResult);
}
-
- /**
- * Set up the environment for performing the tests in this suite.
- *
- * @throws Exception
- * If the environment could not be set up.
- */
- @BeforeClass
- public void setUp() throws Exception {
- // This test suite depends on having the schema available.
- TestCaseUtils.startServer();
- }
}
--
Gitblit v1.10.0