mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
28.47.2010 f2160f4bd1c8ac67e5a86a6710d431e8932877f9
sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/CaseExactIA5SubstringMatchingRuleTest.java
@@ -42,41 +42,22 @@
    SubstringMatchingRuleTest
{
  /**
   * {@inheritDoc}
   */
  @Override
  @DataProvider(name = "substringMiddleMatchData")
  public Object[][] createSubstringMiddleMatchData()
  @DataProvider(name = "substringInvalidAssertionValues")
  public Object[][] createMatchingRuleInvalidAssertionValues()
  {
    return new Object[][] {
        { "this is a value", new String[] { "this" },
            ConditionResult.TRUE },
        { "this is a value", new String[] { "is" },
            ConditionResult.TRUE },
        { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
        { "this is a value", new String[] { "value" },
            ConditionResult.TRUE },
        { "this is a value", new String[] { " " }, ConditionResult.TRUE },
        { "this is a value",
            new String[] { "this", "is", "a", "value" },
            ConditionResult.TRUE },
        // The matching rule requires ordered non overlapping substrings
        // Issue #730 was not valid.
        { "this is a value", new String[] { "value", "this" },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "this", "this is" },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "his is", "a val", },
            ConditionResult.TRUE },
        { "this is a value", new String[] { "not", },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "THIS", },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "this", "not" },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "    " },
            ConditionResult.TRUE }, };
    return new Object[][] { { "12345678\uFFFD", new String[0], null },
        { null, new String[] { "12345678\uFFFD" }, null },
        { null, new String[0], "12345678\uFFFD" }, };
  }
  @Override
  @DataProvider(name = "substringInvalidAttributeValues")
  public Object[][] createMatchingRuleInvalidAttributeValues()
  {
    return new Object[][] { { "12345678\uFFFD" }, };
  }
@@ -85,10 +66,21 @@
   * {@inheritDoc}
   */
  @Override
  protected MatchingRule getRule()
  @DataProvider(name = "substringFinalMatchData")
  public Object[][] createSubstringFinalMatchData()
  {
    return Schema.getCoreSchema().getMatchingRule(
        SMR_CASE_EXACT_IA5_OID);
    return new Object[][] {
        { "this is a value", "value", ConditionResult.TRUE },
        { "this is a value", "alue", ConditionResult.TRUE },
        { "this is a value", "ue", ConditionResult.TRUE },
        { "this is a value", "e", ConditionResult.TRUE },
        { "this is a value", "valu", ConditionResult.FALSE },
        { "this is a value", "this", ConditionResult.FALSE },
        { "this is a value", " ", ConditionResult.FALSE },
        { "this is a value", "VALUE", ConditionResult.FALSE },
        { "this is a VALUE", "value", ConditionResult.FALSE },
        { "end with space    ", " ", ConditionResult.FALSE },
        { "end with space    ", "space", ConditionResult.TRUE }, };
  }
@@ -118,38 +110,40 @@
   * {@inheritDoc}
   */
  @Override
  @DataProvider(name = "substringFinalMatchData")
  public Object[][] createSubstringFinalMatchData()
  @DataProvider(name = "substringMiddleMatchData")
  public Object[][] createSubstringMiddleMatchData()
  {
    return new Object[][] {
        { "this is a value", "value", ConditionResult.TRUE },
        { "this is a value", "alue", ConditionResult.TRUE },
        { "this is a value", "ue", ConditionResult.TRUE },
        { "this is a value", "e", ConditionResult.TRUE },
        { "this is a value", "valu", ConditionResult.FALSE },
        { "this is a value", "this", ConditionResult.FALSE },
        { "this is a value", " ", ConditionResult.FALSE },
        { "this is a value", "VALUE", ConditionResult.FALSE },
        { "this is a VALUE", "value", ConditionResult.FALSE },
        { "end with space    ", " ", ConditionResult.FALSE },
        { "end with space    ", "space", ConditionResult.TRUE }, };
        { "this is a value", new String[] { "this" }, ConditionResult.TRUE },
        { "this is a value", new String[] { "is" }, ConditionResult.TRUE },
        { "this is a value", new String[] { "a" }, ConditionResult.TRUE },
        { "this is a value", new String[] { "value" }, ConditionResult.TRUE },
        { "this is a value", new String[] { " " }, ConditionResult.TRUE },
        { "this is a value", new String[] { "this", "is", "a", "value" },
            ConditionResult.TRUE },
        // The matching rule requires ordered non overlapping substrings
        // Issue #730 was not valid.
        { "this is a value", new String[] { "value", "this" },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "this", "this is" },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "his is", "a val", },
            ConditionResult.TRUE },
        { "this is a value", new String[] { "not", }, ConditionResult.FALSE },
        { "this is a value", new String[] { "THIS", }, ConditionResult.FALSE },
        { "this is a value", new String[] { "this", "not" },
            ConditionResult.FALSE },
        { "this is a value", new String[] { "    " }, ConditionResult.TRUE }, };
  }
  @DataProvider(name = "substringInvalidAttributeValues")
  public Object[][] createMatchingRuleInvalidAttributeValues()
  /**
   * {@inheritDoc}
   */
  @Override
  protected MatchingRule getRule()
  {
    return new Object[][] { { "12345678\uFFFD" }, };
  }
  @DataProvider(name = "substringInvalidAssertionValues")
  public Object[][] createMatchingRuleInvalidAssertionValues()
  {
    return new Object[][] { { "12345678\uFFFD", new String[0], null },
        { null, new String[] { "12345678\uFFFD" }, null },
        { null, new String[0], "12345678\uFFFD" }, };
    return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_IA5_OID);
  }
}