directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tencé, Vincent" <vte...@optimuminformatique.com>
Subject RE: Tests naming
Date Thu, 17 Mar 2005 15:21:58 GMT
I could modify this test to use a precomputed pdu but I still don't get what
we're trying to test. Before committing anything, I'd like to clarify what
the intention of the test is. I need your help!

We're using AbstractDecoderTestCase, so I assume we're trying to test a
decoding operation. I've annoted the test with my understanding and some
questions, pls correct me where I'm missing something.

>    public void testAbandonMessage() throws Exception
>    {
>        AbandonRequestImpl request = new AbandonRequestImpl( 1 ) ;
>        request.setAbandoned( 3 ) ;
>        decode( request ) ;

At this point, we should have decoded the request using the BERDecoder. The
result is in the tlvList.

>        roundTripTest( request ) ;

This is when I get confused. What is roundTripTest doing exactly? See below

>        assertFalse( tlvList.isEmpty() ) ;

Is that enough to test that the tlvList is not empty?

>    }

>    public DefaultMutableTupleNode roundTripTest( Message msg ) throws
Exception
>    {
>        DefaultMutableTupleNode node = null ;
>        ByteBuffer buf1 = encode( msg ) ;

So we're encoding the msg again

>        ttd.decode( buf1 ) ;

to decode it this time with a TupleTreeDecoder ...

>        node = ( DefaultMutableTupleNode ) history.getMostRecent() ;

... which produces a DefaultMutableTupleNode.
>
>        ByteBuffer buf2 = ByteBuffer.allocate( node.size() ) ;
>        node.encode( buf2 ) ;

Then we encode back to ByteBuffer using the node

>        assertTrue( buf1.equals( buf2 ) ) ;

So what are we testing exactly? Decoding, encoding, both? What is the
relation with the BERDecoder and the assert in testAbandonMessage()?
>
>        return node ;
>    }

Thanks,
-- Vincent

> -----Original Message-----
> From: Alex Karasulu [mailto:aok123@bellsouth.net]
> Sent: March 16, 2005 1:53 PM
> To: Apache Directory Developers List
> Subject: Re: Tests naming
> 
> 
> Change things as you like.  I will follow your lead with the 
> test case 
> naming and all.  
> 
> This test ....
> 
>    public void testAbandonMessage() throws Exception
>    {
>        AbandonRequestImpl request = new AbandonRequestImpl( 1 ) ;
>        request.setAbandoned( 3 ) ;
>        decode( request ) ;
>        roundTripTest( request ) ;
>        assertFalse( tlvList.isEmpty() ) ;
>    }
> 
> ... generates an AbandonRequest PDU testing the encoding decoding 
> projects.  Take a look at the abstract test class and the functions 
> built into it for convenience.
> 
> Let me know if you need help,
> Alex
> 

Mime
View raw message