Author: akarasulu Date: Thu Aug 26 05:10:26 2004 New Revision: 37073 Added: incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/compare/ incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/compare/CompareRequestEncoderTest.java (contents, props changed) Log: Added passing test case for CompareRequestImpl.
Added: incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/compare/CompareRequestEncoderTest.java ============================================================================== --- (empty file) +++ incubator/directory/snickers/branches/encoder-redesign/ldap-ber-provider/src/test/org/apache/snickers/ldap/encoder/compare/CompareRequestEncoderTest.java Thu Aug 26 05:10:26 2004 @@ -0,0 +1,53 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.snickers.ldap.encoder.compare; + + +import org.apache.snickers.ber.TupleNode; +import org.apache.snickers.ber.DefaultMutableTupleNode; + +import org.apache.ldap.common.message.CompareRequestImpl; + +import org.apache.snickers.ldap.encoder.AbstractEncoderTestCase; + + +/** + * TestCase for the CompareRequestEncoder class. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> + * @version $ + */ +public class CompareRequestEncoderTest extends AbstractEncoderTestCase +{ + /** + * Tests the encode() method of the CompareRequest stub encoder. + */ + public void testEncode() + { + CompareRequestImpl req = new CompareRequestImpl( 444 ); + req.setName( "dc=apache,dc=org" ); + req.setAttributeId( "dc" ); + req.setAssertionValue( "apache.org" ); + + // Encode stub into tuple tree then into the accumulator + TupleNode node = CompareRequestEncoder.INSTANCE.encode( req ); + encode( ( DefaultMutableTupleNode ) node ); + + // Test to see if original stub equals the round trip generated stub + assertTrue( req.equals( decode() ) ); + } +} \ No newline at end of file
