java - Using mockito with wildcard agruments -


i trying pass wildcard mockito any() method. method

selectgatewayinfoconfig(operation<?> o) 

what trying is:

when(gatewayconfigselector.selectgatewayinfoconfig( any(**!!!!!! here need wildcard !!!!**));                 .thenreturn(...something...); 

thanks in advance.

how about?

when(gatewayconfigselector.selectgatewayinfoconfig( any(operation.class));             .thenreturn(...something...); 

example:

@test public void test() {     tester mock = mockito.mock(tester.class);     mockito.when(mock.selectgatewayinfoconfig(mockito.any(operation.class))).thenreturn("blah");      system.out.println(mock.selectgatewayinfoconfig(null)); }   class operation<t> {  }  class tester {      public string selectgatewayinfoconfig(operation<?> o) {         return "hi";     } } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -