I have encountered what Sebb mentions more than once, I do like the "test"
prefix to make it obvious what is and is not intended to be a test. Same
reason I like to make test methods public: clear intent. I know Junit 5
proposes to change these conventions, the benefit do not outweigh the
convention we use in Commons today for me.

Gary

On Thu, Feb 17, 2022, 07:03 sebb <[email protected]> wrote:

> On Thu, 17 Feb 2022 at 01:16, Gilles Sadowski <[email protected]>
> wrote:
> >
> > Hello.
> >
> > > [...]
> > >
> > > One more practical question: since the tests are not anymore based on
> the
> > > methods name and are indicated by annotations now, I've seen tests
> without
> > > this "test" in the beginning. Looks like common practice (including
> it's
> > > the way it's presented in the JUnit 5 docs). Since I'll dig into all
> the
> > > tests, I can make this change as well. I like this style, because it
> looks
> > > more "clean" to me. What do you think, should I change the methods
> names as
> > > well?
> > >
> >
> > Gary notes the practical reason for not mixing types of changes
> > but you can certainly start a discussion about changing the
> > convention.  I agree that, in
> > ---CUT---
> > @Test
> > public void testSomething() {
> >     // ...
> > }
> > ---CUT---
> > there is one "test" too many.
>
> Yes and no.
>
> Apart from it being unnecessary to change the name, it can be helpful
> to distinguish top-level test methods from helper methods.
> Makes it easier to check if there is a missing (or spurious) annotation.
>
> > Regards,
> > Gilles
> >
> > > > [...]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to