@Test public void testContainsInstanceWithInstancesThatAreEqualButDistinct() throws Exception { List<Instance> list = new ArrayList<>(); list.add(new Instance("fiona")); assertFalse( "Must return false if instance is not in the supplied Collection argument", CollectionUtils.containsInstance(list, new Instance("fiona"))); }
@Test public void testContainsInstanceWithNullInstance() throws Exception { List<Instance> list = new ArrayList<>(); list.add(new Instance("apple")); list.add(new Instance("fiona")); assertFalse( "Must return false if null instance is supplied", CollectionUtils.containsInstance(list, null)); }
@Test public void testContainsInstanceWithSameInstance() throws Exception { List<Instance> list = new ArrayList<>(); list.add(new Instance("apple")); Instance instance = new Instance("fiona"); list.add(instance); assertTrue( "Must return true if instance is in the supplied Collection argument", CollectionUtils.containsInstance(list, instance)); }
@Test public void testContainsInstanceWithNullCollection() throws Exception { assertFalse( "Must return false if supplied Collection argument is null", CollectionUtils.containsInstance(null, this)); }