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

neil_a_wilson
03.52.2007 e1ea3e0d8999105f144d2be98e0286928b8319ed
opends/tests/unit-tests-testng/src/server/org/opends/server/interop/LazyDNTestCase.java
@@ -40,6 +40,7 @@
import org.opends.server.TestCaseUtils;
import org.opends.server.types.DN;
import org.opends.server.types.RDN;
import org.opends.server.types.SearchScope;
import static org.testng.Assert.*;
@@ -110,6 +111,10 @@
    sigs.add(new String[] { "isAncestorOf",
                            "boolean",
                            "org.opends.server.types.DN" });
    sigs.add(new String[] { "matchesBaseAndScope",
                            "boolean",
                            "org.opends.server.types.DN",
                            "org.opends.server.types.SearchScope" });
    sigs.add(new String[] { "equals",
                            "boolean",
                            "java.lang.Object" });
@@ -578,6 +583,40 @@
  /**
   * Tests the {@code matchesBaseAndScope} method with valid DN strings.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testMatchesBaseAndScope()
         throws Exception
  {
    assertTrue(new LazyDN("").matchesBaseAndScope(DN.nullDN(),
                                                  SearchScope.BASE_OBJECT));
    assertTrue(new LazyDN("dc=example,dc=com").matchesBaseAndScope(
                    DN.decode("dc=example,dc=com"), SearchScope.BASE_OBJECT));
    assertTrue(new LazyDN("ou=People,dc=example,dc=com").matchesBaseAndScope(
                    DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE));
  }
  /**
   * Tests the {@code matchesBaseAndScope} method with an invalid DN string.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test(expectedExceptions = { RuntimeException.class })
  public void testMatchesBaseandScopeInvalid()
         throws Exception
  {
    new LazyDN("invalid").matchesBaseAndScope(DN.decode("dc=example,dc=com"),
                                              SearchScope.WHOLE_SUBTREE);
  }
  /**
   * Tests the {@code equals} method with valid DN strings.
   *
   * @throws  Exception  If an unexpected problem occurs.