Package org.assertj.core.description

Examples of org.assertj.core.description.TextDescription


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

    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 and day as:\n  " +
                                    "<2011-01-01T06:05:17>\n" +
                                    "but had not.");
  }
View Full Code Here


    StringBuilder b = new StringBuilder();
    b.append("[Test] \nFile:\n <abc>\nand file:\n <xyz>\ndo not have equal content:");
    for (String diff : diffs)
      b.append(LINE_SEPARATOR).append(diff);
    assertEquals(b.toString(), factory.create(new TextDescription("Test"), new StandardRepresentation()));
  }
View Full Code Here

    StringBuilder b = new StringBuilder();
    b.append("[Test] \nInputStreams do not have equal content:");
    for (String diff : diffs)
      b.append(LINE_SEPARATOR).append(diff);
    assertEquals(b.toString(), factory.create(new TextDescription("Test"), new StandardRepresentation()));
  }
View Full Code Here

    factory = shouldBeIn("Yoda", array("Luke", "Leia"));
  }

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

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

    factory = shouldStartWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia"));
  }

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

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    factory = shouldStartWith(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 start with:\n <[\"Han\", \"Leia\"]>\n"
        + "when comparing values using 'CaseInsensitiveStringComparator'", message);
  }
View Full Code Here

        newArrayList("Han", "Leia"));
  }

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

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    ErrorMessageFactory factory = shouldContainSubsequence(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 contain subsequence:\n <[\"Han\", \"Leia\"]>\n"
        + "when comparing values using 'CaseInsensitiveStringComparator'", message);
  }
View Full Code Here

    factory = elementsShouldBe(newArrayList("Yoda", "Luke", "Leia"), newArrayList("Leia"), 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<[\"Leia\"]>\n of \n<[\"Yoda\", \"Luke\", \"Leia\"]>\n to be <a Jedi>", message);
  }
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.