Hi. I've been treating my mockito-java8 as a deprecated project - with all the major features already available in mockito-core. However, recently, I've been migrating some big project from Mockito 1.x to 2.x/4.x and I wasn't able to find a simple way to perform inline asserting in verification, such as:
```
@Test
void shouldAllowToUseAssertionInLambdaWithPrimitiveAsArgument() {
//when
ts.fireTorpedo(2);
//then
verify(ts).fireTorpedo(assertArg(i -> assertThat(i).isEqualTo(2)));
}
```
As ArgumentMacher has a return type, it is problematic to do it in one line (an extra "return true" is required - a custom Matcher has to be created).
Of course it can also be done with ArgumentCaptor, but it is even 3 lines instead od 1.
The implementation in mockito-java8 is trivial:
https://github.com/szpak/mockito-java8/blob/7c9f30b0d53445a9dd0c7a380cdab58a0079d716/src/main/java/info/solidsoft/mockito/java8/AssertionMatcher.java#L50If I missed something existing, please let me know. In the other case, I wonder, if you are open to accept assertArg() addition to the mockito-core (to be able to officially deprecated mockito-java8 :) )?
Marcin
--
https://blog.solidsoft.pl/ - Solid Soft - Working code is not enough