@Test public void testCheckIfYouWillBeHanged() throws Exception { final Royalty goodMoodRoyalty = mock(Royalty.class); when(goodMoodRoyalty.getMood()).thenReturn(true); final Royalty badMoodRoyalty = mock(Royalty.class); when(badMoodRoyalty.getMood()).thenReturn(true); final List<Royalty> goodCompany = new ArrayList<>(); goodCompany.add(goodMoodRoyalty); goodCompany.add(goodMoodRoyalty); goodCompany.add(goodMoodRoyalty); final List<Royalty> badCompany = new ArrayList<>(); goodCompany.add(goodMoodRoyalty); goodCompany.add(goodMoodRoyalty); goodCompany.add(badMoodRoyalty); assertTrue(new Servant("test").checkIfYouWillBeHanged(goodCompany)); assertTrue(new Servant("test").checkIfYouWillBeHanged(badCompany)); }
public boolean checkIfYouWillBeHanged(List<Royalty> tableGuests) { boolean anotherDay = true; for (Royalty r : tableGuests) { if (!r.getMood()) { anotherDay = false; } } return anotherDay; }
Servant { public boolean checkIfYouWillBeHanged(List<Royalty> tableGuests) { boolean anotherDay = true; for (Royalty r : tableGuests) { if (!r.getMood()) { anotherDay = false; } } return anotherDay; } }
Servant { public boolean checkIfYouWillBeHanged(List<Royalty> tableGuests) { boolean anotherDay = true; for (Royalty r : tableGuests) { if (!r.getMood()) { anotherDay = false; } } return anotherDay; } Servant(String name); }
Servant { public boolean checkIfYouWillBeHanged(List<Royalty> tableGuests) { boolean anotherDay = true; for (Royalty r : tableGuests) { if (!r.getMood()) { anotherDay = false; } } return anotherDay; } Servant(String name); void feed(Royalty r); void giveWine(Royalty r); void giveCompliments(Royalty r); boolean checkIfYouWillBeHanged(List<Royalty> tableGuests); }
Servant { public boolean checkIfYouWillBeHanged(List<Royalty> tableGuests) { boolean anotherDay = true; for (Royalty r : tableGuests) { if (!r.getMood()) { anotherDay = false; } } return anotherDay; } Servant(String name); void feed(Royalty r); void giveWine(Royalty r); void giveCompliments(Royalty r); boolean checkIfYouWillBeHanged(List<Royalty> tableGuests); public String name; }