to me, filtering collections seems to be a separate concern, which
should not be mixed with assertions.
I suggest to factor out filtering and create a new subproject dedicated
to collection filtering, which could be called FEST-Filter.
Besides, I like the "Filter conditions builder" idea, and I'd love to
see a unified approach for expressing conditions in both FEST-Assert and
a potential new FEST-Filter module (i. e. use a consistent API for
FEST-Assert and FEST-Filter conditions).
Looks like we need to invest in inventing a good fluent "Condition
building API"
Best regards
Ansgar
>> A || (B&& C)
I agree with Ansgar. Filtering needs to be separate from the assertion
fluent interface. It can still be in the same project though, but not
in the same method chain.
I made a similar point at http://jira.codehaus.org/browse/FEST-404 ,
here is what I wrote:
<quote>
Before we start working on this feature, I'd like to start a
conversation on the mailing list.
This issue is kind-of-related to an old one that someone brought
sometime ago, suggesting an API for checking exceptions similar to
this:
assertThat(exception).cause().isInstanceOf(IllegalArgumentException.class);
The problem here is the context switch. isInstanceOf does not apply
any more to the original target of assertThat, but its cause. IMO, the
target should never change, which means that every single assertion
method in the chain should apply to the object in assertThat.
I noticed this context-switch too late for onProperty. Please, don't
get me wrong, I love onProperty. But again, it switches targets. In
the 2.x branch, I changed this, in a way that the code needs to be
written as follows:
// employees is a List of Employee
List<?> ids = extractProperty("id").from(employees);
assertThat(ids).contains(32342, 12319);
I suggest to do the filtering in the same way, outside of the
"assertThat" chain.
</quote>
Having said that, I'd love to see the filter API take Conditions to
perform the filtering.
Talking about Conditions, in the 2.x prototype I move all the "heavy
lifting" from the assertion classes to helper, singleton utilities
that can be reused when writing Conditions.
I'll adding the team to the 2.x repo this weekend. I haven't done it
earlier due to time constraints :D
Cheers!
-Alex
> --
> You received this message because you are subscribed to the Google Groups
> "easytesting-dev" group.
> To post to this group, send email to easytes...@googlegroups.com.
> To unsubscribe from this group, send email to
> easytesting-d...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/easytesting-dev?hl=en.
>
>