Package org.assertj.core.presentation

Examples of org.assertj.core.presentation.StandardRepresentation


    factory = shouldBeOfClassIn("Yoda", newArrayList(Long.class, File.class));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TestDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n <\"Yoda\">\nto be of one these types:\n <[java.lang.Long, java.io.File]>\nbut was:\n <java.lang.String>",
        message);
  }
View Full Code Here


    factory = elementsShouldBeAtMost(newArrayList("Yoda", "Luke", "Obiwan"), 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\", \"Luke\", \"Obiwan\"]>\n to be at most 2 times <a Jedi>", message);
  }
View Full Code Here

  @Before public void setup() {
    factory = shouldBeReadable(new FakeFile("pathname"));
  }

  @Test public void createExpectedMessage() {
    String actualMessage = factory.create(new TestDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting file:\n <pathname>\nto be readable", actualMessage);
  }
View Full Code Here

  @Test
  public void should_create_error_message() throws ParseException {
    ErrorMessageFactory factory = shouldBeInSameSecondWindow(parseDatetimeWithMs("2011-01-01T05:00:01.000"),
                                                             parseDatetimeWithMs("2011-01-01T05:00:02.001"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertThat(message).isEqualTo("[Test] \nExpecting:\n  <2011-01-01T05:00:01>\nto be close to:\n  " +
                                    "<2011-01-01T05:00:02>\nby less than one second (strictly) but difference was: 1s" +
                                    " and 1ms");
  }
View Full Code Here

    factory = shouldNotBeOfClassIn("Yoda", newArrayList(Long.class, String.class));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TestDescription("Test"), new StandardRepresentation());
    assertEquals(
        "[Test] \nExpecting:\n <\"Yoda\">\nnot to be of any type in:\n <[java.lang.Long, java.lang.String]>\nbut was of type:<java.lang.String>",
        message);
  }
View Full Code Here

    factory = shouldNotBe("Yoda", new TestCondition<String>("Sith"));
  }

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

                                     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\", \"Han\"]>\n" +
        "to contain only once:\n" +
        " <[\"Luke\", \"Yoda\"]>\n" +
        "but some elements were not found:\n" +
View Full Code Here

  @Test
  public void should_create_error_message_with_custom_comparison_strategy() {
    ErrorMessageFactory factory = shouldContainsOnlyOnce(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] \n" +
        "Expecting:\n" +
        " <[\"Yoda\", \"Han\"]>\n" +
        "to contain only once:\n" +
        " <[\"Luke\", \"Yoda\"]>\n" +
View Full Code Here

  @Test
  public void should_create_error_message_without_not_found_elements() {
    factory = shouldContainsOnlyOnce(newArrayList("Yoda", "Han", "Han"), newArrayList("Yoda"), newLinkedHashSet(),
                                     newLinkedHashSet("Han"));
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n" +
        " <[\"Yoda\", \"Han\", \"Han\"]>\n" +
        "to contain only once:\n" +
        " <[\"Yoda\"]>\n" +
        "but some elements were found more than once:\n" +
View Full Code Here

  @Test
  public void should_create_error_message_without_elements_found_many_times() {
    factory = shouldContainsOnlyOnce(newArrayList("Yoda", "Han"), newArrayList("Luke"), newLinkedHashSet("Luke"),
                                     newLinkedHashSet());
    String message = factory.create(new TextDescription("Test"), new StandardRepresentation());
    assertEquals("[Test] \nExpecting:\n" +
        " <[\"Yoda\", \"Han\"]>\n" +
        "to contain only once:\n" +
        " <[\"Luke\"]>\n" +
        "but some elements were not found:\n" +
View Full Code Here

TOP

Related Classes of org.assertj.core.presentation.StandardRepresentation

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.