Hello again. Recently I have accidentally found a library awaitility which the main purpose is to make assertions with timeout possible to do in a convenient way. Currently it supports only Hamcrest, but a little bit of hacking I was able to implement functionality similar to previously posted without touching fest-assert classes at all. There is already all required timeout related stuff implemented I think it could be a better idea that hacking into fest-assert internal classes.
There is also one important thing. Thanks to its custom proxy mechanism, it is possible to make something I already deleted from my original the features list - ability to assert with timeout on immutable types (with some limitations).
In the following example (with Hamcrest):
to() static method creates a proxy which "retake" an immutable value from the object on each assertion withing specified time period. But there is one problem .
I like very much type safe fluent API in fest-assert, but it makes it harder to use it from other libraries. I was able with some hints from the awaitility author to using some hacks (and 4 Callable structures) make it work (still PoC) with fest-assert and immutable types:
but it is needed to call assertThat directly in the implementation inside awaitility to keep fluent interface faced to the user and still control it. It needs a lot of boilerplate code (twice as much like in Assertions class). The similar proxy on *Assert to pasted in my last comment was also used, but the main problem remains the same (to that in pure fest-assert solution) - final methods in fest-assert.
It seems to be not possible to proxy them. Even worst - they are silently ignored. There are unfortunately many final method in *Assert classes (e.g. AbstractComparableAssert) which make assertion with timeout to work only partially.
I have two question.
1. In case you had some time to look into maybe you would have some better idea how fest-assert could be integrated into awaitlity (the discussion, my PoC, awaitility documentation)?
2. I know that methods marked as final should not be overridden in deriving assertion classes, but what would it an impact of removing it (final) in fest-assert 2.0? Or maybe you see the other way how would they be proxied?