The one "usage" of any()
I know about - it is something that mocking libraries like Mockito make use of. See here for example.
To be precise: when you have a mocked object and you specify "expected" calls, then you would be doing something like:
when(someMock.someMethod(any())).thenReturn(whatever);
This basically tells the framework: any object passed should "match". In contrast to:
when(someMock.someMethod(someSpecificValue)).thenReturn(whatever);
that means: only when someMethod() is invoked with that specific value, whatever should be returned.
any(SomeClass.class)
is basically a "legacy" version - explicitly stating the expected class. See here for example for further documentation.
No idea about with()
though.