You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emmanuel Lecharny <el...@gmail.com> on 2007/09/30 23:31:13 UTC

Re: svn commit: r580770 - in /directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/messages: ./ NtpTimeStampTest.java

Hi Stefan,

just a few things :

1) as we are using Junit4, you don't need to specify that the class
extends TestCase
2) you just need to add the @Test annotation in front of each test method :
  @Test public void testEqualsForDifferent() throws ParseException
3) To do so, you will have to add those imports :
import org.junit.Test;
4) For setUp and tearDown, add @Before and @After in front of them
5) The metjod names don't anymore have to start with 'test', but I
think it's a good politic to keep this prefix
6) For assertXXX, just add
import static org.junit.Assert.assertXXX; (static is important)
7)SimpleDateFormat is not synchronized. In case JUnit launch tests in
// (not really the case right now, but in the next version ...), you
might be surprised ;)

Emmanuel

PS: I guess that a page on the developper wiki about Junit4 usgae
could have helped ...

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: svn commit: r580770 - in /directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/messages: ./ NtpTimeStampTest.java

Posted by Alex Karasulu <ak...@apache.org>.
Yeah I'd be interested in a primer too as well as some general conventions
we should follow
with JUnit4.  I guess we will learn and apply new conventions as we go but
any recommendations
are good.

Alex

On 9/30/07, Emmanuel Lecharny <el...@gmail.com> wrote:
>
> Hi Stefan,
>
> just a few things :
>
> 1) as we are using Junit4, you don't need to specify that the class
> extends TestCase
> 2) you just need to add the @Test annotation in front of each test method
> :
>   @Test public void testEqualsForDifferent() throws ParseException
> 3) To do so, you will have to add those imports :
> import org.junit.Test;
> 4) For setUp and tearDown, add @Before and @After in front of them
> 5) The metjod names don't anymore have to start with 'test', but I
> think it's a good politic to keep this prefix
> 6) For assertXXX, just add
> import static org.junit.Assert.assertXXX; (static is important)
> 7)SimpleDateFormat is not synchronized. In case JUnit launch tests in
> // (not really the case right now, but in the next version ...), you
> might be surprised ;)
>
> Emmanuel
>
> PS: I guess that a page on the developper wiki about Junit4 usgae
> could have helped ...
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>