Package org.fest.assertions.description

Examples of org.fest.assertions.description.Description


    comparables.assertEqual(mock(Description.class), actual, expected);
  }

  @Test
  public void should_fail_if_objects_are_not_equal() {
    Description info = new TestDescription("Testing");
    try {
      comparables.assertEqual(info, "Luke", "Yoda");
    } catch (AssertionError e) {
      assertEquals("[Testing] expected:<'[Yoda]'> but was:<'[Luke]'>", e.getMessage());
      return;
View Full Code Here


  @Rule
  public ExpectedException thrown = none();

  @Test
  public void should_set_description() {
    Description description = new TestDescription("testing");
    Matcher<Object> matcher = new Matcher<Object>(description) {
      @Override
      public boolean matches(Object value) {
        return false;
      }
View Full Code Here

  }

  @Test
  public void should_throw_error_if_description_is_null() {
    thrown.expect(NullPointerException.class);
    Description description = null;
    new Matcher<Object>(description) {
      @Override
      public boolean matches(Object value) {
        return false;
      }
View Full Code Here

    messageFormatter.format(null, "", args);
  }

  @Test
  public void should_format_message() {
    Description description = new TextDescription("Test");
    String s = messageFormatter.format(description, "Hello %s", "World");
    assertEquals("[Test] Hello 'World'", s);
    verify(descriptionFormatter).format(description);
  }
View Full Code Here

    strings.assertEndsWith(mock(Description.class), null, "Yoda");
  }

  @Test
  public void should_fail_if_actual_does_not_end_with_suffix() {
    Description description = new TestDescription("Testing");
    try {
      strings.assertEndsWith(description, "Yoda", "Luke");
    } catch (AssertionError e) {
      verify(failures).failure(description, shouldEndWith("Yoda", "Luke"));
      return;
View Full Code Here

    factory.formatter = formatter;
  }

  @Test
  public void should_implement_toString() {
    Description description = new TestDescription("Test");
    String formattedMessage = "[Test] Hello Yoda";
    when(formatter.format(description, "Hello %s", "Yoda")).thenReturn(formattedMessage);
    assertEquals(formattedMessage, factory.create(description));
  }
View Full Code Here

  }

  @Test
  public void should_fail_if_Matcher_is_not_met() {
    matcher.shouldMatch(false);
    Description description = new TestDescription("Testing");
    try {
      matchers.assertIs(description, "Yoda", matcher);
    } catch (AssertionError e) {
      assertEquals("[Testing] expecting:<'Yoda'> to be:<TestMatcher>", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here

    objects.assertSame(mock(Description.class), actual, actual);
  }

  @Test
  public void should_fail_if_objects_are_not_same() {
    Description description = new TestDescription("Testing");
    try {
      objects.assertSame(description, "Yoda", "Luke");
    } catch (AssertionError e) {
      assertEquals("[Testing] expected:<'Luke'> and actual:<'Yoda'> should refer to the same instance", e.getMessage());
      verify(failures).failure(same(description), any(ErrorMessageFactory.class));
View Full Code Here

    throw expectedAssertionErrorNotThrown();
  }

  @Test
  public void should_fail_if_objects_are_different_instances_but_with_same_value() {
    Description description = new TestDescription("Testing");
    Object actual = new Person("Yoda");
    Object expected = new Person("Yoda");
    try {
      objects.assertSame(description, actual, expected);
    } catch (AssertionError e) {
View Full Code Here

    objects.assertEqual(mock(Description.class), "Yoda", "Yoda");
  }

  @Test
  public void should_pass_if_objects_are_different_instances_but_with_same_value() {
    Description description = new TestDescription("Testing");
    Object actual = new Person("Yoda");
    Object expected = new Person("Yoda");
    objects.assertEqual(description, actual, expected);
  }
View Full Code Here

TOP

Related Classes of org.fest.assertions.description.Description

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.