### Question:
Servant { public void giveWine(Royalty r) { r.getDrink(); } Servant(String name); void feed(Royalty r); void giveWine(Royalty r); void giveCompliments(Royalty r); boolean checkIfYouWillBeHanged(List<Royalty> tableGuests); public String name; }### Answer:
@Test public void testGiveWine() { final Royalty royalty = mock(Royalty.class); final Servant servant = new Servant("test"); servant.giveWine(royalty); verify(royalty).getDrink(); verifyNoMoreInteractions(royalty); }
@Test public void testGiveWine() { final var royalty = mock(Royalty.class); final var servant = new Servant("test"); servant.giveWine(royalty); verify(royalty).getDrink(); verifyNoMoreInteractions(royalty); }
@Test public void testGiveWine() throws Exception { final Royalty royalty = mock(Royalty.class); final Servant servant = new Servant("test"); servant.giveWine(royalty); verify(royalty).getDrink(); verifyNoMoreInteractions(royalty); }