@Test public void should_create_error_message() { ErrorMessageFactory factory = shouldNotContain( newArrayList("Yoda"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Yoda")); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); assertEquals( "[Test] \nExpecting\n <[\"Yoda\"]>\nnot to contain\n <[\"Luke\", \"Yoda\"]>\nbut found\n <[\"Yoda\"]>\n", message); }
@Test public void should_create_error_message_with_custom_comparison_strategy() { ErrorMessageFactory factory = shouldNotContain( newArrayList("Yoda"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Yoda"), new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance)); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); assertEquals( "[Test] \nExpecting\n <[\"Yoda\"]>\nnot to contain\n <[\"Luke\", \"Yoda\"]>\n" + "but found\n <[\"Yoda\"]>\naccording to 'CaseInsensitiveStringComparator' comparator", message); }