@Test public void testGetServicesForPod() { IService match = mock(IService.class); when(match.getSelector()).thenReturn(serviceSelector); IService nomatch = mock(IService.class); when(nomatch.getSelector()).thenReturn(new HashMap<>()); Collection<IService> services = Arrays.asList(nomatch, match); IService[] exp = new IService[] {match}; assertArrayEquals(exp, getServicesForPod(pod, services).toArray()); }