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

coulbeck
06.25.2006 40450a7a2e414012aa72eac790efce0a57a3e0c4
More unit test coverage for SearchRequestProtocolOp.
1 files modified
69 ■■■■■ changed files
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestSearchProtocolOp.java 69 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestSearchProtocolOp.java
@@ -118,6 +118,12 @@
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestSequence() throws Exception
  {
    ProtocolOp.decode(new ASN1Integer(OP_TYPE_SEARCH_REQUEST, 0));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestTooManyElements() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
@@ -153,4 +159,67 @@
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement1() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(1, new ASN1OctetString());
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement2() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(2, new ASN1OctetString());
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement3() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(3, new ASN1OctetString());
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement4() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(4, new ASN1OctetString());
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement5() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(5, new ASN1OctetString());
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement6() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(6, new ASN1OctetString());
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
  @Test (expectedExceptions = LDAPException.class)
  public void testInvalidSearchRequestElement7() throws Exception
  {
    ASN1Element element = buildSearchRequestProtocolOp().encode();
    ArrayList<ASN1Element> elements = ((ASN1Sequence)element).elements();
    elements.set(7, new ASN1OctetString("cn"));
    ProtocolOp.decode(new ASN1Sequence(OP_TYPE_SEARCH_REQUEST, elements));
  }
}