@Test public void shouldNotQueryHeavyRootsForClassesTheyDoNotContain() throws IOException { when(this.child1.classNames()).thenReturn(Collections.singletonList("Foo")); when(this.heavyChild.classNames()).thenReturn(Collections.singletonList("Heavy")); when(this.child2.classNames()).thenReturn(Collections.singletonList("Bar")); this.testee.getData("Bar"); verify(this.heavyChild,never()).getData("Bar"); this.testee.getData("Heavy"); verify(this.heavyChild).getData("Heavy"); }
@Test public void shouldReturnNamesOfAllClassesKnownByChildren() { when(this.child1.classNames()).thenReturn(Collections.singletonList("Foo")); when(this.child2.classNames()).thenReturn(Collections.singletonList("Bar")); when(this.heavyChild.classNames()).thenReturn(Collections.singletonList("Heavy")); assertThat(this.testee.classNames()).containsOnly("Foo", "Bar", "Heavy"); }