Ed
unread,Nov 27, 2009, 12:29:07 PM11/27/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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... :)