Examples of TextDescription


Examples of org.assertj.core.description.TextDescription

  @Test
  public void should_create_error_message() {
    Map<?, ?> map = mapOf(entry("name", "Yoda"), entry("color", "green"));
    ErrorMessageFactory factory = shouldNotContainValue(map, "green");
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <{\"name\"=\"Yoda\", \"color\"=\"green\"}>\nnot to contain value:\n <\"green\">", message);
  }
View Full Code Here

Examples of org.assertj.core.description.TextDescription

        newLinkedHashSet("Han"));
  }

  @Test
  public void should_create_error_message() {
    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\"]>\n",
        message);
  }
View Full Code Here

Examples of org.assertj.core.description.TextDescription

  @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.description.TextDescription

  }

  @Test
  public void should_create_error_message_when_only_elements_order_differs() {
    factory = shouldContainExactly("Luke", "Han", 1);
    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\">\n", message);
  }
View Full Code Here

Examples of org.assertj.core.description.TextDescription

  @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'",
        message);
  }
View Full Code Here

Examples of org.assertj.core.description.TextDescription

  @Test
  public void should_create_error_message() throws ParseException {
    ErrorMessageFactory factory = shouldBeInSameMinuteWindow(parseDatetime("2011-01-01T05:00:00"),
                                                             parseDatetime("2011-01-01T05:02:01"));

    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting:\n  <2011-01-01T05:00:00>\nto be close to:\n  " +
                                    "<2011-01-01T05:02:01>\n" +
                                    "by less than one minute (strictly) but difference was: 2m and 1s");
  }
View Full Code Here

Examples of org.assertj.core.description.TextDescription

  factory = shouldBeGreaterOrEqual(6, 8);
  }

  @Test
  public void should_create_error_message() {
  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" +
                                " <8> ");
View Full Code Here

Examples of org.assertj.core.description.TextDescription

  }

  @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" +
                                " <8> when comparing values using 'AbsValueComparator'");
View Full Code Here

Examples of org.assertj.core.description.TextDescription

    factory = elementsShouldBeExactly(newArrayList("Yoda", "Solo", "Leia"), 2, new TestCondition<String>("a Jedi"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting elements:\n<[\"Yoda\", \"Solo\", \"Leia\"]>\n to be exactly 2 times <a Jedi>", message);
  }
View Full Code Here

Examples of org.assertj.core.description.TextDescription

    factory = elementsShouldHaveAtMost(newArrayList("Yoda", "Luke", "Obiwan"), 2, new TestCondition<String>("Jedi power"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting elements:\n<[\"Yoda\", \"Luke\", \"Obiwan\"]>\n to have at most 2 times <Jedi power>", message);
  }
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.