alexruiz / fest-assert-2.x

FEST Fluent Assertions 2.x
http://fest.easytesting.org
Apache License 2.0
400 stars 69 forks source link

Make Fest Assertions more type safe #39

Open joel-costigliola opened 12 years ago

joel-costigliola commented 12 years ago

Each class/interface that has S (self type) parameter should specify an upper bound. it makes the code more type safe as the returned assertion object is considered by the compiler as the upper bound type.

This was done for EnumerableAssert :

public interface EnumerableAssert<S extends EnumerableAssert<S, T>, T>

As S extends EnumerableAssert, the compiler knows that the returned object in assertion (S) can be considered as of EnumerableAssert type.

We should od the same for ComparableAssert (and probably some other interface/class) :

public interface ComparableAssert<S, A extends Comparable<? super A>>
ash2k commented 12 years ago

You meant

public interface ComparableAssert<S extends ComparableAssert<A>, A extends Comparable<? super A>>