Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 23926 invoked from network); 30 Jan 2011 14:40:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Jan 2011 14:40:53 -0000 Received: (qmail 39147 invoked by uid 500); 30 Jan 2011 14:40:52 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 39091 invoked by uid 500); 30 Jan 2011 14:40:51 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 39078 invoked by uid 99); 30 Jan 2011 14:40:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Jan 2011 14:40:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Jan 2011 14:40:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A95DF2388A39; Sun, 30 Jan 2011 14:40:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1065297 - /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java Date: Sun, 30 Jan 2011 14:40:26 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110130144026.A95DF2388A39@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Sun Jan 30 14:40:26 2011 New Revision: 1065297 URL: http://svn.apache.org/viewvc?rev=1065297&view=rev Log: Fixed the subentries control tests Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java?rev=1065297&r1=1065296&r2=1065297&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java (original) +++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java Sun Jan 30 14:40:26 2011 @@ -31,9 +31,8 @@ import org.apache.directory.junit.tools. import org.apache.directory.junit.tools.ConcurrentJunitRunner; import org.apache.directory.shared.asn1.DecoderException; import org.apache.directory.shared.asn1.EncoderException; -import org.apache.directory.shared.ldap.model.message.controls.Subentries; import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator; -import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesContainer; +import org.apache.directory.shared.ldap.model.message.controls.Subentries; import org.apache.directory.shared.util.Strings; import org.junit.Test; import org.junit.runner.RunWith; @@ -52,7 +51,7 @@ public class SubEntryControlTest * Test the decoding of a SubEntryControl with a true visibility */ @Test - public void testDecodeSubEntryVisibilityTrue() + public void testDecodeSubEntryVisibilityTrue() throws Exception { ByteBuffer bb = ByteBuffer.allocate( 0x03 ); bb.put( new byte[] @@ -61,20 +60,12 @@ public class SubEntryControlTest } ); bb.flip(); - SubentriesContainer container = new SubentriesContainer(); - SubentriesDecorator decorator = container.getSubentriesControl(); + SubentriesDecorator decorator = new SubentriesDecorator(); - try - { - decorator.decode( bb.array() ); - } - catch ( DecoderException de ) - { - de.printStackTrace(); - fail( de.getMessage() ); - } + Subentries subentries = (Subentries)decorator.decode( bb.array() ); - assertTrue( ( ( Subentries ) decorator.getDecorated() ).isVisible() ); + assertTrue( subentries.isVisible() ); + // test encoding try { @@ -108,7 +99,7 @@ public class SubEntryControlTest * Test the decoding of a SubEntryControl with a false visibility */ @Test - public void testDecodeSubEntryVisibilityFalse() + public void testDecodeSubEntryVisibilityFalse() throws Exception { ByteBuffer bb = ByteBuffer.allocate( 0x03 ); bb.put( new byte[] @@ -117,20 +108,11 @@ public class SubEntryControlTest } ); bb.flip(); - SubentriesContainer container = new SubentriesContainer(); - SubentriesDecorator decorator = container.getSubentriesControl(); + SubentriesDecorator decorator = new SubentriesDecorator(); - try - { - decorator.decode( bb.array() ); - } - catch ( DecoderException de ) - { - de.printStackTrace(); - fail( de.getMessage() ); - } + Subentries subentries = (Subentries)decorator.decode( bb.array() ); - assertFalse( ( ( Subentries ) decorator.getDecorated() ).isVisible() ); + assertFalse( subentries.isVisible() ); // test encoding try @@ -164,8 +146,8 @@ public class SubEntryControlTest /** * Test the decoding of a SubEntryControl with an empty visibility */ - @Test - public void testDecodeSubEntryEmptyVisibility() + @Test( expected=DecoderException.class ) + public void testDecodeSubEntryEmptyVisibility() throws Exception { ByteBuffer bb = ByteBuffer.allocate( 0x02 ); @@ -177,26 +159,17 @@ public class SubEntryControlTest bb.flip(); // Allocate a LdapMessage Container - SubentriesContainer container = new SubentriesContainer(); - SubentriesDecorator decorator = container.getSubentriesControl(); + SubentriesDecorator decorator = new SubentriesDecorator(); - try - { - decorator.decode( bb.array() ); - fail( "We should never reach this point !!!" ); - } - catch ( DecoderException de ) - { - assertTrue( true ); - } + decorator.decode( bb.array() ); } /** * Test the decoding of a bad SubEntryControl */ - @Test - public void testDecodeSubEntryBad() + @Test( expected=DecoderException.class ) + public void testDecodeSubEntryBad() throws Exception { ByteBuffer bb = ByteBuffer.allocate( 0x03 ); @@ -208,17 +181,8 @@ public class SubEntryControlTest bb.flip(); // Allocate a LdapMessage Container - SubentriesContainer container = new SubentriesContainer(); - SubentriesDecorator decorator = container.getSubentriesControl(); + SubentriesDecorator decorator = new SubentriesDecorator(); - try - { - decorator.decode( bb.array() ); - fail( "We should never reach this point !!!" ); - } - catch ( DecoderException de ) - { - assertTrue( true ); - } + decorator.decode( bb.array() ); } }