### Question:
Exercise4 { static <A> Boolean contains(final List<A> list, final A searched) { return Lists.foldLeft(list, false, (contains, item) -> contains || item.equals(searched) ); }    }### Answer:
@Test public void shouldNotContainAValueOnAnEmptyList() { final List<Integer> emptyList = emptyList(); final Boolean expected = false; final Boolean actual = Exercise4.contains(emptyList, 1); assertThat(actual, is(expected)); }
@Test public void shouldNotContainAValue() { final List<Integer> list = asList(2, 3, 4); final Boolean expected = false; final Boolean actual = Exercise4.contains(list, 1); assertThat(actual, is(expected)); }
@Test public void shouldContainAValue() { final List<String> stringList = asList("test", "of", "a", "function"); final Boolean expected = true; final Boolean actual = Exercise4.contains(stringList, "test"); assertThat(actual, is(expected)); }