 <p>You can use Mockito to mock out interface A.</p> <pre><code>@Test public void test () { //given: we have our expected and actual lists. List&lt;String&gt; expectedResult = Arrays.asList("id1","id2","id3"); //build our actual list of mocked interface A objects. A a1 = mock(A.class); when(a1.getId()).thenReturn("id1"); A a2 = mock(A.class); when(a2.getId()).thenReturn("id2"); A a3 = mock(A.class); when(a3.getId()).thenReturn("id3"); B b = mock(B.class); Collection&lt;A&gt; actualResult = Arrays.asList(a1, a2,a3); //when: we invoke the method we want to test. when(b.getCollection()).thenReturn(actualResult); //then: we should have the result we want. assertNotNull(actualResult); assertEquals(3, actualResult.size()); for (A a : actualResult) assertTrue(expectedResult.contains(a.getId())); } </code></pre>