Package org.assertj.core.description

Examples of org.assertj.core.description.TextDescription


    factory = shouldBeBeforeOrEqualsTo(parse("2011-01-01"), parse("2012-01-01"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <2011-01-01T00:00:00>\nto be before or equals to:\n <2012-01-01T00:00:00>", message);
  }
View Full Code Here


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

  private ErrorMessageFactory factory;

  @Test
  public void should_create_error_message() {
    factory = shouldEndWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <[\"Yoda\", \"Luke\"]>\nto end with:\n <[\"Han\", \"Leia\"]>\n", message);
  }
View Full Code Here

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

  @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());
  assertThat(message).isEqualTo("[Test] \n" +
                                "Expecting\n" +
                                " <[\"Yoda\"]>\n" +
                                "not to contain\n" +
                                " <[\"Luke\", \"Yoda\"]>\n" +
View Full Code Here

  ErrorMessageFactory factory = shouldNotContain(newArrayList("Yoda"),
                                                 newArrayList("Luke", "Yoda"),
                                                 newLinkedHashSet("Yoda"),
                                                 new ComparatorBasedComparisonStrategy(
                                                                                       CaseInsensitiveStringComparator.instance));
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n" +
                                "Expecting\n" +
                                " <[\"Yoda\"]>\n" +
                                "not to contain\n" +
                                " <[\"Luke\", \"Yoda\"]>\n" +
View Full Code Here

    factory = shouldBe("Yoda", new TestCondition<String>("green"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <\"Yoda\">\nto be <green>", message);
  }
View Full Code Here

  @Test
  public void should_create_error_message_ignoring_millisseconds() throws ParseException {
    ErrorMessageFactory factory = shouldBeEqual(parseDatetimeWithMs("2011-01-01T05:00:00.000"),
                                                parseDatetimeWithMs("2011-01-01T06:05:17.003"), TimeUnit.MILLISECONDS);

    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting:\n  <2011-01-01T05:00:00>\n" +
                                    "to have same year, month, day, hour, minute and second as:\n  " +
                                    "<2011-01-01T06:05:17>\n" +
                                    "but had not.");
  }
View Full Code Here

  @Test
  public void should_create_error_message_ignoring_seconds() throws ParseException {
    ErrorMessageFactory factory = shouldBeEqual(parseDatetimeWithMs("2011-01-01T05:00:00.000"),
                                                parseDatetimeWithMs("2011-01-01T06:05:17.003"), TimeUnit.SECONDS);

    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting:\n  <2011-01-01T05:00:00>\n" +
                                    "to have same year, month, day, hour and minute as:\n  " +
                                    "<2011-01-01T06:05:17>\n" +
                                    "but had not.");
  }
View Full Code Here

  @Test
  public void should_create_error_message_ignoring_miinutes() throws ParseException {
    ErrorMessageFactory factory = shouldBeEqual(parseDatetimeWithMs("2011-01-01T05:00:00.000"),
                                                parseDatetimeWithMs("2011-01-01T06:05:17.003"), TimeUnit.MINUTES);

    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting:\n  <2011-01-01T05:00:00>\n" +
                                    "to have same year, month, day and hour as:\n  " +
                                    "<2011-01-01T06:05:17>\n" +
                                    "but had not.");
  }
View Full Code Here

TOP

Related Classes of org.assertj.core.description.TextDescription

Copyright © 2018 www.massapicom. 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.