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... :)
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 ) :)
On Fri, Nov 27, 2009 at 9:29 AM, Ed <post2edb...@gmail.com> wrote:
> 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... :)
> --
> You received this message because you are subscribed to the Google Groups
> "easytesting" group.
> To post to this group, send email to easytesting@googlegroups.com.
> To unsubscribe from this group, send email to
> easytesting+unsubscribe@googlegroups.com<easytesting%2Bunsubscribe@googlegr oups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/easytesting?hl=en.
> 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
> On Fri, Nov 27, 2009 at 9:29 AM, Ed <post2edb...@gmail.com> wrote:
> > 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... :)
> > --
> > You received this message because you are subscribed to the Google Groups
> > "easytesting" group.
> > To post to this group, send email to easytesting@googlegroups.com.
> > To unsubscribe from this group, send email to
> > easytesting+unsubscribe@googlegroups.com<easytesting%2Bunsubscribe@googlegr oups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/easytesting?hl=en.