Package org.assertj.core.description

Examples of org.assertj.core.description.TextDescription


  }

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
  factory = shouldBeGreater(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:\n" +
                                " <8> when comparing values using 'AbsValueComparator'");
View Full Code Here


  public void should_create_error_message_for_iterable() {
  List<Object> list = new ArrayList<Object>();
  list.add("Yoda");
  list.add(5L);
  ErrorMessageFactory factory = shouldHaveOnlyElementsOfType(list, String.class, Long.class);
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n"
                                + "Expecting:\n"
                                + "  <[\"Yoda\", 5L]>\n"
                                + "to only have elements of type:\n"
                                + "  <java.lang.String>\n"
View Full Code Here

  @Test
  public void should_create_error_message_for_array() {
  Object[] array = new Object[] { "Yoda", 5L };
  ErrorMessageFactory factory = shouldHaveOnlyElementsOfType(array, String.class, Long.class);
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n"
                                + "Expecting:\n"
                                + "  <[\"Yoda\", 5L]>\n"
                                + "to only have elements of type:\n"
                                + "  <java.lang.String>\n"
View Full Code Here

    factory = shouldContainOnly(newArrayList("Yoda", "Han"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Luke"), 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 only:\n <[\"Luke\", \"Yoda\"]>\n"
        + "elements not found:\n <[\"Luke\"]>\nand elements not expected:\n <[\"Han\"]>\n", message);
  }
View Full Code Here

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    ErrorMessageFactory factory = shouldContainOnly(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 only:\n <[\"Luke\", \"Yoda\"]>\n"
        + "elements not found:\n <[\"Luke\"]>\nand elements not expected:\n <[\"Han\"]>\n"
        + "when comparing values using 'CaseInsensitiveStringComparator'", message);
  }
View Full Code Here

    factory = shouldBeAfterOrEqualsTo(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 after or equals to:\n <2012-01-01T00:00:00>", message);
  }
View Full Code Here

    factory = shouldNotContainAtIndex(newArrayList("Yoda", "Luke"), "Luke", atIndex(1));
  }

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

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

public class ShouldNotBeBetween_create_Test {

  @Test
  public void should_create_error_message_with_period_boundaries_included() {
    ErrorMessageFactory factory = shouldNotBeBetween(parse("2009-01-01"), parse("2011-01-01"), parse("2012-01-01"), true, true);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <2009-01-01T00:00:00>\nnot to be in period:\n [2011-01-01T00:00:00, 2012-01-01T00:00:00]", message);
  }
View Full Code Here

  }

  @Test
  public void should_create_error_message_with_period_lower_boundary_included() {
    ErrorMessageFactory factory = shouldNotBeBetween(parse("2012-01-01"), parse("2011-01-01"), parse("2012-01-01"), true, false);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <2012-01-01T00:00:00>\nnot to be in period:\n [2011-01-01T00:00:00, 2012-01-01T00:00:00[", 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.