@Test public void testResourceHandlers() { NewResourceHandler rh1 = mock(NewResourceHandler.class); NewResourceHandler rh2 = mock(NewResourceHandler.class); when(rh1.getResourceType()).thenReturn(new JavaResourceTypeDefinition(new Model())); when(rh2.getResourceType()).thenReturn(new ProjectImportsResourceTypeDefinition(new Others())); doReturn(Arrays.asList(rh1, rh2)).when(this.resourceHandlerManager).getNewResourceHandlers(); List<NewResourceHandler> handlers = this.resourceHandlerManager.getNewResourceHandlers(resourceHandler -> resourceHandler.getResourceType().getCategory().equals(new Model())); assertTrue(handlers.size() == 1); assertEquals(rh1, handlers.get(0)); }
public List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher) { List<NewResourceHandler> matchedNewResourceHandlers = new ArrayList<>(); getNewResourceHandlers().forEach(newResourceHandler -> { if (matcher.apply(newResourceHandler)) { matchedNewResourceHandlers.add(newResourceHandler); } }); return matchedNewResourceHandlers; }
ResourceHandlerManager { public List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher) { List<NewResourceHandler> matchedNewResourceHandlers = new ArrayList<>(); getNewResourceHandlers().forEach(newResourceHandler -> { if (matcher.apply(newResourceHandler)) { matchedNewResourceHandlers.add(newResourceHandler); } }); return matchedNewResourceHandlers; } }
ResourceHandlerManager { public List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher) { List<NewResourceHandler> matchedNewResourceHandlers = new ArrayList<>(); getNewResourceHandlers().forEach(newResourceHandler -> { if (matcher.apply(newResourceHandler)) { matchedNewResourceHandlers.add(newResourceHandler); } }); return matchedNewResourceHandlers; } ResourceHandlerManager(); @Inject  ResourceHandlerManager(SyncBeanManager beanManager, ClientTypeRegistry clientTypeRegistry); }
ResourceHandlerManager { public List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher) { List<NewResourceHandler> matchedNewResourceHandlers = new ArrayList<>(); getNewResourceHandlers().forEach(newResourceHandler -> { if (matcher.apply(newResourceHandler)) { matchedNewResourceHandlers.add(newResourceHandler); } }); return matchedNewResourceHandlers; } ResourceHandlerManager(); @Inject  ResourceHandlerManager(SyncBeanManager beanManager, ClientTypeRegistry clientTypeRegistry); List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher); Iterable<NewResourceHandler> getNewResourceHandlers(); }
ResourceHandlerManager { public List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher) { List<NewResourceHandler> matchedNewResourceHandlers = new ArrayList<>(); getNewResourceHandlers().forEach(newResourceHandler -> { if (matcher.apply(newResourceHandler)) { matchedNewResourceHandlers.add(newResourceHandler); } }); return matchedNewResourceHandlers; } ResourceHandlerManager(); @Inject  ResourceHandlerManager(SyncBeanManager beanManager, ClientTypeRegistry clientTypeRegistry); List<NewResourceHandler> getNewResourceHandlers(final Function<NewResourceHandler, Boolean> matcher); Iterable<NewResourceHandler> getNewResourceHandlers();  }