### Question:
Servant { public boolean checkIfYouWillBeHanged(List<Royalty> tableGuests) { return tableGuests.stream().allMatch(Royalty::getMood); } 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 testCheckIfYouWillBeHanged() { final var goodMoodRoyalty = mock(Royalty.class); when(goodMoodRoyalty.getMood()).thenReturn(true); final var badMoodRoyalty = mock(Royalty.class); when(badMoodRoyalty.getMood()).thenReturn(true); final var goodCompany = List.of(goodMoodRoyalty, goodMoodRoyalty, goodMoodRoyalty); final var badCompany = List.of(goodMoodRoyalty, goodMoodRoyalty, badMoodRoyalty); assertTrue(new Servant("test").checkIfYouWillBeHanged(goodCompany)); assertTrue(new Servant("test").checkIfYouWillBeHanged(badCompany)); }