Examples of ComparatorBasedComparisonStrategy


Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

  @Before
  public void setUp() {
    failures = spy(new Failures());
    dates = new Dates();
    dates.failures = failures;
    yearAndMonthComparisonStrategy = new ComparatorBasedComparisonStrategy(comparatorForCustomComparisonStrategy());
    datesWithCustomComparisonStrategy = new Dates(yearAndMonthComparisonStrategy);
    datesWithCustomComparisonStrategy.failures = failures;
    initActualDate();
  }
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

  }

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    ErrorMessageFactory factory = shouldContainExactly(newArrayList("Yoda", "Han"), newArrayList("Luke", "Yoda"),
        newLinkedHashSet("Luke"), newLinkedHashSet("Han"), new ComparatorBasedComparisonStrategy(
            CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <[\"Yoda\", \"Han\"]>\nto contain exactly (and in same order):\n"
        + " <[\"Luke\", \"Yoda\"]>\nbut some elements were not found:\n <[\"Luke\"]>\nand others were not expected:\n"
        + " <[\"Han\"]>\nwhen comparing values using 'CaseInsensitiveStringComparator'", message);
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

            + " <\"Luke\">\nwhereas expected element was:\n <\"Han\">\n", message);
  }

  @Test
  public void should_create_error_message_when_only_elements_order_differs_according_to_custom_comparison_strategy() {
    factory = shouldContainExactly("Luke", "Han", 1, new ComparatorBasedComparisonStrategy(
        CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals(
        "[Test] \nActual and expected have the same elements but not in the same order, at index 1 actual element was:\n"
            + " <\"Luke\">\nwhereas expected element was:\n <\"Han\">\nwhen comparing values using 'CaseInsensitiveStringComparator'",
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

                                " <8> ");
  }

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
  factory = shouldBeGreaterOrEqual(6, 8, new ComparatorBasedComparisonStrategy(new AbsValueComparator<Integer>()));
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n" +
                                "Expecting:\n" +
                                " <6>\n" +
                                "to be greater than or equal to:\n" +
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

    assertEquals("[Test] \nExpecting:\n <\"Yoda\">\nnot to contain:\n <\"od\"> ", message);
  }

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    ErrorMessageFactory factory = shouldNotContain("Yoda", "od", new ComparatorBasedComparisonStrategy(
        CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <\"Yoda\">\nnot to contain:\n <\"od\"> when comparing values using 'CaseInsensitiveStringComparator'",
        message);
  }
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

  @Before
  public void setUp() {
    failures = spy(new Failures());
    arrays = new ShortArrays();
    arrays.failures = failures;
    absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(comparatorForCustomComparisonStrategy());
    arraysWithCustomComparisonStrategy = new ShortArrays(absValueComparisonStrategy);
    arraysWithCustomComparisonStrategy.failures = failures;
    initActualArray();
  }
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

  public void should_create_error_message_with_custom_comparison_strategy() {
    String[] sequenceValues = { "{", "author", "title", "}" };
    String actual = "{ 'title':'A Game of Thrones', 'author':'George Martin'}";

    factory = shouldContainSequence(actual, sequenceValues, 1,
                                    new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <\"" + actual + "\">\n"
        + "to contain the following CharSequences in this order:\n"
        + " <[\"{\", \"author\", \"title\", \"}\"]>\n"
        + "but <\"title\"> was found before <\"author\">\n"
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

                                " <6> ");
  }

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
  factory = shouldBeLess(8, 6, new ComparatorBasedComparisonStrategy(new AbsValueComparator<Integer>()));
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n" +
                                "Expecting:\n" +
                                " <8>\n" +
                                "to be less than:\n" +
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

  }

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    factory = shouldContain("Yoda", "Luke",
                            new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <\"Yoda\">\nto contain:\n <\"Luke\"> when comparing values using 'CaseInsensitiveStringComparator'",
                 message);
  }
View Full Code Here

Examples of org.assertj.core.internal.ComparatorBasedComparisonStrategy

  @Before
  public void setUp() {
    failures = spy(new Failures());
    arrays = new LongArrays();
    arrays.failures = failures;
    absValueComparisonStrategy = new ComparatorBasedComparisonStrategy(comparatorForCustomComparisonStrategy());
    arraysWithCustomComparisonStrategy = new LongArrays(absValueComparisonStrategy);
    arraysWithCustomComparisonStrategy.failures = failures;
    initActualArray();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.