[
https://issues.apache.org/jira/browse/HBASE-18925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16218068#comment-16218068
]
Appy commented on HBASE-18925:
------------------------------
FIxed TestRpcScheduler. The issue was any(Foo.class) doesn't match null
anymore. Only any() matches null.
>From mockito docs
>(https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2)
{quote}
anyX() and any(SomeType.class) matchers now reject nulls and check type. This
has been long waited feature, making Mockito syntax more intuitive. (In the
following list T represents some type like Integer, List)
* <T> T any() will matches anything including null
* T anyT() / <T> any(Class<T>) are aliases of <T> isA(T), will matches non-null
object of given type. e.g. :
** int anyInt() won't match null (for Integers) anymore
** String anyString() won't match null (for Strings) anymore, and will check
the object is indeed a String
** Map<K, V> anyMap() won't match null (for Maps) anymore, and will check the
object is indeed a Map
** <T> List<T> anyListOf(Class<T>) will match non-null List, and will check the
object is indeed a List
{quote}
> Need updated mockito for using java optional
> --------------------------------------------
>
> Key: HBASE-18925
> URL: https://issues.apache.org/jira/browse/HBASE-18925
> Project: HBase
> Issue Type: Improvement
> Reporter: Appy
> Assignee: Appy
> Fix For: 2.0.0-beta-1
>
> Attachments: HBASE-18925.master.001.patch,
> HBASE-18925.master.002.patch, HBASE-18925.master.002.patch,
> HBASE-18925.master.003.patch, HBASE-18925.master.004.patch
>
>
> Came up when i was trying to test HBASE-18878.
> It kept failing because mock of RpcCall returned null where return type was
> Optional<User>.
> Instead, we want it to return Optional.empty().
> New mockito versions support this (and other java8 things) -
> https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2
> We use mockito-all which was last released in Dec2014. However, mockito-core
> has had more than 50 releases after that
> (https://mvnrepository.com/artifact/org.mockito/mockito-core).
> We need to change our deps from mockito-all to mockito-core.
> However that comes with fair breakages, so this is not a simple task of
> changing pom files.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)