Package org.assertj.core.description

Examples of org.assertj.core.description.TextDescription


  }

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

  factory = shouldNotBeIn("Luke", array("Luke", "Leia"));
  }

  @Test
  public void should_create_error_message() {
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n"
                                + "Expecting:\n"
                                + " <\"Luke\">\n"
                                + "not to be in:\n"
                                + " <[\"Luke\", \"Leia\"]>\n");
View Full Code Here

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
  factory = shouldNotBeIn("Luke", array("Luke", "Leia"),
                          new ComparatorBasedComparisonStrategy(CaseInsensitiveStringComparator.instance));
  String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
  assertThat(message).isEqualTo("[Test] \n"
                                + "Expecting:\n"
                                + " <\"Luke\">\n"
                                + "not to be in:\n"
                                + " <[\"Luke\", \"Leia\"]>\n"
View Full Code Here

    factory = shouldContain(newArrayList("Yoda"), newArrayList("Luke", "Yoda"), newLinkedHashSet("Luke"));
  }

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

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


  @Test
  public void should_create_error_message_differentiating_long_from_integer() {
    factory = shouldContain(5L, 5, 5);
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <5L>\nto contain:\n <5>\nbut could not find:\n"
        + " <5>\n", message);
  }
View Full Code Here

  }

  @Test
  public void should_create_error_message_differentiating_long_from_integer_in_arrays() {
    factory = shouldContain(newArrayList(5L, 7L), newArrayList(5, 7), newLinkedHashSet(5, 7));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <[5L, 7L]>\nto contain:\n <[5, 7]>\nbut could not find:\n"
        + " <[5, 7]>\n", message);
  }
View Full Code Here

  }

  @Test
  public void should_create_error_message_differentiating_double_from_float() {
    factory = shouldContain(newArrayList(5d, 7d), newArrayList(5f, 7f), newLinkedHashSet(5f, 7f));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <[5.0, 7.0]>\nto contain:\n <[5.0f, 7.0f]>\nbut could not find:\n"
        + " <[5.0f, 7.0f]>\n", message);
  }
View Full Code Here

    factory = shouldBeSameGenericBetweenIterableAndCondition(newArrayList("Yoda", "Leia"), new TestCondition<String>("Not a Jedi"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting: <[\"Yoda\", \"Leia\"]> have the same generic type as condition <Not 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.