ServiceServices { void addMethodsToMethodsService(Method[] methods, List<OcelotMethod> methodsService) { for (Method method : methods) { if (serviceTools.isConsiderateMethod(method)) { methodsService.add(getOcelotMethod(method)); } } }  List<OcelotService> getServices(HttpSession httpSession);  }
@Test public void testAddMethodsToMethodsService() { System.out.println("addMethodsToMethodsService"); Method[] methods = ClassAsDataService.class.getDeclaredMethods(); List<OcelotMethod> methodsService = mock(List.class); when(serviceTools.isConsiderateMethod(any(Method.class))).thenReturn(Boolean.FALSE).thenReturn(Boolean.TRUE).thenReturn(Boolean.TRUE).thenReturn(Boolean.FALSE); doReturn(mock(OcelotMethod.class)).when(instance).getOcelotMethod(any(Method.class)); instance.addMethodsToMethodsService(methods, methodsService); verify(methodsService, times(2)).add(any(OcelotMethod.class)); }