CollectionUtils { public static boolean containsUserEstimate(final Collection<Estimate> estimates, final String userName) { return estimates.stream().anyMatch(input -> input.getUserName().equalsIgnoreCase(userName)); } private  CollectionUtils(); static boolean containsIgnoreCase(final Collection<String> collection, final String matching); static boolean containsUserEstimate(final Collection<Estimate> estimates, final String userName);  }
@Test public void testContainsUserEstimate() throws Exception { final String userName = "Rich A"; final Estimate estimate = new Estimate(userName, "5"); final Collection<Estimate> estimates = Sets.newHashSet(estimate); assertTrue(CollectionUtils.containsUserEstimate(estimates, userName)); }
@Test public void testNotContainsUserEstimate() throws Exception { final Estimate estimate = new Estimate("Rich A", "5"); final Collection<Estimate> estimates = Sets.newHashSet(estimate); assertFalse(CollectionUtils.containsUserEstimate(estimates, "Jimmy Page")); }