Open GoogleCodeExporter opened 8 years ago
I understand it would be nice, but I don't think we will do it as it will
require a dependency on Guava.
However you should be able to customize the behavior of the default answer to
do that.
Mockito.mock(SomeClass.class, DEFAULT_ANSWER_WITH_OPTIONAL);
static Answer DEFAULT_ANSWER_WITH_OPTIONAL = new Answer() {
// ... your code
}
Would that fit your needs ?
Original comment by brice.du...@gmail.com
on 20 Jun 2012 at 8:16
Interesting. It would be nice if Mockito provided an easy way to register a
default return value for a certain type. So that you could use the current
Mockito's defaults plus some more custom stuff.
This is now somewhat possible with the default answer (if you delegate to the
mockito defaults for all other types) of the MockitoConfiguration.
Original comment by szcze...@gmail.com
on 20 Jun 2012 at 11:40
Original comment by brice.du...@gmail.com
on 20 Jul 2012 at 10:45
Please see Issue #497 for an enhancement for java.util.Optional.
Original comment by phjar...@gmail.com
on 8 Jul 2014 at 8:46
Original issue reported on code.google.com by
jatw...@linuxstuff.org
on 19 Jun 2012 at 11:04