fest-assert-2.x icon indicating copy to clipboard operation
fest-assert-2.x copied to clipboard

ListAssert inherits from IterableAssert and remove AbstractIterableAssert ?

Open nfrancois opened this issue 13 years ago • 3 comments

I just remember of this TODO. For recall, ListAssert header is :

public class ListAssert<T> extends AbstractIterableAssert<ListAssert<T>, List<T>, T> implements IndexedObjectEnumerableAssert<T>

I think we should, there is not reason against and to have better logical hierarchy.

nfrancois avatar May 29 '12 09:05 nfrancois

No, this will break returned self type on methods from IterableAssert in ListAssert (we loose S generic when extend).

ash2k avatar May 29 '12 12:05 ash2k

I think we should move all the code from ListAssert to the new class AbstractListAssert and make ListAssert extend it. This will enable library users to extend AbstractListAssert (like other abstract assert classes) and take all assertions from it - this improves extensibility of lib.

Also, this "idea" is applicable to other assert implementations that do not have abstract classes. Maybe move all code from concrete classes to abstract ones (also respecting type hierarchy)?

ash2k avatar May 29 '12 12:05 ash2k

@ash2k I tend to agree with you, let's start with ListAssert and AbstractListAssert, we will do the remaining classes later to avoid a too big workload.

joel-costigliola avatar May 30 '12 08:05 joel-costigliola