Generics type on the base classes ?

1 view
Skip to first unread message

Ed

unread,
Nov 27, 2009, 12:29:07 PM11/27/09
to easytesting
Hellu,

Why not use put a Generic parameter on the base classes like
PrimitiveAssert (a bit like the Enum generics).
Why? I think you can move up quick a bit of code that is now contained
in the subclass to support the Fluent API.
Example:
public abstract class PrimitiveAssert<T extends PrimitiveAssert<T>>
extends Assert {

So the as method can now move up and become part of the
PrimitiveAssert:
@SuppressWarnings("unchecked")
public T as(String description) {
description(description);
return (T) this;
}

Even do, it contains a supress warning, it absolutely safe. Just try
it...
I tested it and it works fine.

If you choise to implement this, you could move up quite a lot of
code, which of course has a lot of benefits... :)

Alex Ruiz

unread,
Nov 27, 2009, 2:28:18 PM11/27/09
to easyt...@googlegroups.com
Hi Ed,

There is already a task that involves removing PrimitiveAssert and consolidate everything under one base class. It is part of the fix for FEST-133 ( http://jira.codehaus.org/browse/FEST-133 ) :)

Cheers,
-Alex


--

You received this message because you are subscribed to the Google Groups "easytesting" group.
To post to this group, send email to easyt...@googlegroups.com.
To unsubscribe from this group, send email to easytesting...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/easytesting?hl=en.



Ed

unread,
Nov 27, 2009, 2:39:14 PM11/27/09
to easytesting
Ok, sorry for the duplicate.
I have to admit, that I searched.. but fast ;)
I just voted FEST-133

On Nov 27, 8:28 pm, Alex Ruiz <alex.ruiz...@gmail.com> wrote:
> Hi Ed,
>
> There is already a task that involves removing PrimitiveAssert and
> consolidate everything under one base class. It is part of the fix for
> FEST-133 (http://jira.codehaus.org/browse/FEST-133) :)
>
> Cheers,
> -Alex
> > easytesting...@googlegroups.com<easytesting%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages