ServiceServices { public List<OcelotService> getServices(HttpSession httpSession) { List<OcelotService> result = new ArrayList<>(); Options options = (Options) httpSession.getAttribute(Constants.Options.OPTIONS); if(options == null) { options = new Options(); httpSession.setAttribute(Constants.Options.OPTIONS, options); } options.setMonitor(true); for (Object dataservice : dataservices) { Class<?> cls = unProxyClassServices.getRealClass(dataservice.getClass()); if(!cls.isAnnotationPresent(DashboardOnDebug.class) || options.isDebug()) { OcelotService ocelotService = new OcelotService(serviceTools.getInstanceNameFromDataservice(cls)); result.add(ocelotService); addMethodsToMethodsService(cls.getMethods(), ocelotService.getMethods()); } } return result; }  List<OcelotService> getServices(HttpSession httpSession);  }
@Test public void testGetServices() { System.out.println("getServices"); ((FakeCDI)dataservices).add(new ClassAsDataService()); HttpSession httpSession = mock(HttpSession.class); when(unProxyClassServices.getRealClass(any(Class.class))).thenReturn((Class) ClassAsDataService.class); when(serviceTools.getInstanceNameFromDataservice(any(Class.class))).thenReturn("ClassAsDataService"); doNothing().when(instance).addMethodsToMethodsService(any(Method[].class), any(List.class)); when(httpSession.getAttribute(Constants.Options.OPTIONS)).thenReturn(new Options()); List<OcelotService> services = instance.getServices(httpSession); assertThat(services).hasSize(1); }