davidkarlsen
12/30/2018, 8:25 PMMockito.`when`(ccmService.getApplication(Mockito.eq(appName), Mockito.eq(finodsGroup)))
.thenReturn(Optional.of(Application(
0L,
appName,
"",
email, null, "jfr", "EOS", email, employee, employee, employee, employee)))
but I get
-> at com.evry.fs.arch.icpautomate.automator.AutomatorServiceTest.testCreateNamespace(AutomatorServiceTest.kt:39)
You cannot use argument matchers outside of verification or stubbing.
Examples of correct usage of argument matchers:
when(mock.get(anyInt())).thenReturn(null);
doThrow(new RuntimeException()).when(mock).someVoidMethod(anyObject());
verify(mock).someMethod(contains("foo"))
This message may appear after an NullPointerException if the last matcher is returning an object
like any() but the stubbed method signature expect a primitive argument, in this case,
use primitive alternatives.
when(mock.get(any())); // bad use, will raise NPE
when(mock.get(anyInt())); // correct usage use
the mock is injected with:
@MockBean(name = "ccmServiceImpl")
lateinit var ccmService: CcmService
davidkarlsen
12/30/2018, 8:48 PMmp
12/31/2018, 8:16 AMreified
functions it looks very powerfulpoohbar
01/08/2019, 2:00 AM