Last Updated: February 25, 2016
·
350
· sbennettmcleish

Mockito nulls

When you want to match a null in your mocks ...

classUnderTest = mock(ClassUnderTest.class);
when(classUnderTest.methodUnderTest(isNull(MyClass.class)).thenReturn(false);