### Question:
MagicServiceImpl implements MagicService { @Override public List<Wizard> findWizardsWithSpell(String name) { var spell = spellDao.findByName(name); var spellbook = spell.getSpellbook(); return new ArrayList<>(spellbook.getWizards()); } MagicServiceImpl(WizardDao wizardDao, SpellbookDao spellbookDao, SpellDao spellDao); @Override List<Wizard> findAllWizards(); @Override List<Spellbook> findAllSpellbooks(); @Override List<Spell> findAllSpells(); @Override List<Wizard> findWizardsWithSpellbook(String name); @Override List<Wizard> findWizardsWithSpell(String name);  }### Answer:
@Test public void testFindWizardsWithSpell() throws Exception { final var wizards = Set.of( mock(Wizard.class), mock(Wizard.class), mock(Wizard.class) ); final var spellbook = mock(Spellbook.class); when(spellbook.getWizards()).thenReturn(wizards); final var spellbookDao = mock(SpellbookDao.class); final var wizardDao = mock(WizardDao.class); final var spell = mock(Spell.class); when(spell.getSpellbook()).thenReturn(spellbook); final var spellName = "spellname"; final var spellDao = mock(SpellDao.class); when(spellDao.findByName(eq(spellName))).thenReturn(spell); final var service = new MagicServiceImpl(wizardDao, spellbookDao, spellDao); verifyZeroInteractions(wizardDao, spellbookDao, spellDao, spellbook); final var result = service.findWizardsWithSpell(spellName); verify(spellDao).findByName(eq(spellName)); verify(spellbook).getWizards(); assertNotNull(result); assertEquals(3, result.size()); verifyNoMoreInteractions(wizardDao, spellbookDao, spellDao); }