You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by wolverine my <wo...@gmail.com> on 2006/12/22 16:05:07 UTC

How to unit test MessageDecoder and MessageEncoder

Hi!

I have written my own MessageDecoder and MessageEncoder.

Is it possible to unit test these two classes before the server and
client areready?
If yes, please give me some hints of how to unit test these codec classes.

Thank you!

Re: How to unit test MessageDecoder and MessageEncoder

Posted by Trustin Lee <tr...@gmail.com>.
Hi Wolverine,

On 12/23/06, wolverine my <wo...@gmail.com> wrote:
>
> Hi!
>
> I have written my own MessageDecoder and MessageEncoder.
>
> Is it possible to unit test these two classes before the server and
> client areready?


Well, it really doesn't have any differences from unit-testing usual java
objects.  You could create some mock objects and use them as parameters for
each call (e.g. decode()), and check the result (the content of
ProtocolDecoderOutput or return value).

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6