Package org.assertj.core.description

Examples of org.assertj.core.description.Description


    factory.formatter = formatter;
  }

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


*/
public class EmptyTextDescription_emptyText_Test {

  @Test
  public void should_return_singleton_instance() {
    Description description = EmptyTextDescription.emptyText();
    for (int i = 0; i < 6; i++)
      assertSame(description, EmptyTextDescription.emptyText());
  }
View Full Code Here

    assertEquals("my message", failure.getMessage());
  }

  @Test
  public void should_use_ErrorMessage_when_overriding_error_message_is_not_specified() {
    Description description = new TestDescription("description");
    info.description(description);
    when(errorMessage.create(description, info.representation())).thenReturn("[description] my message");
    AssertionError failure = failures.failure(info, errorMessage);
    assertEquals("[description] my message", failure.getMessage());
  }
View Full Code Here

  }

  @Test
  public void should_use_AssertionErrorFactory_when_overriding_error_message_is_not_specified() {
    MyOwnAssertionError expectedError = new MyOwnAssertionError("[description] my message");
    Description description = new TestDescription("description");
    info.description(description);
    when(errorFactory.newAssertionError(description, info.representation())).thenReturn(expectedError);
    AssertionError failure = failures.failure(info, errorFactory);
    assertSame(expectedError, failure);
  }
View Full Code Here

    assertNull(info.descriptionText());
  }

  @Test
  public void should_return_text_of_description() {
    Description description = mock(Description.class);
    info.description(description);
    when(description.value()).thenReturn("Yoda");
    assertEquals("Yoda", info.descriptionText());
  }
View Full Code Here

  @Rule
  public ExpectedException thrown = none();

  @Test
  public void should_set_description() {
    Description d = new TextDescription("always in motion is the future");
    Condition<Object> condition = new Condition<Object>(d) {
      @Override
      public boolean matches(Object value) {
        return false;
      }
View Full Code Here

  public ExpectedException thrown = none();

  @Test
  public void should_throw_error_if_description_is_null() {
    thrown.expectNullPointerException(descriptionIsNull());
    Description d = null;
    DescriptionValidations.checkIsNotNull(d);
  }
View Full Code Here

    DescriptionValidations.checkIsNotNull(d);
  }

  @Test
  public void should_return_description_with_given_text() {
    Description d = DescriptionValidations.checkIsNotNull("Yoda");
    assertEquals("Yoda", d.value());
  }
View Full Code Here

    assertEquals("Yoda", d.value());
  }

  @Test
  public void should_return_same_description() {
    Description e = new TextDescription("Yoda");
    Description d = DescriptionValidations.checkIsNotNull(e);
    assertSame(e, d);
  }
View Full Code Here

TOP

Related Classes of org.assertj.core.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.