Package org.fest.assertions.description

Examples of org.fest.assertions.description.TextDescription


   private String prefix;

   @Override
   public Description description() {
      return (prefix == null) ? super.description()
               : new TextDescription(computeDescribitionText());
   }
View Full Code Here


    matcher = new TestMatcher<Object>();
  }

  @Test
  public void should_return_description() {
    matcher.description = new TextDescription("Testing");
    assertEquals("Testing", matcher.description().value());
  }
View Full Code Here

  /**
   * Creates a new {@link Matcher}. The default description of this matcher will the simple name of the matcher's
   * class.
   */
  public Matcher() {
    this.description = new TextDescription(getClass().getSimpleName());
  }
View Full Code Here

   *
   * @param description the description of this matcher.
   * @throws NullPointerException if the given description is {@code null}.
   */
  public Matcher(String description) {
    this(new TextDescription(description));
  }
View Full Code Here

    factory = shouldHaveSize(newArrayList("Luke", "Yoda"), 2, 8);
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"));
    assertEquals("[Test] expecting:\n<8> but was:<2> in:<['Luke', 'Yoda']>", message);
  }
View Full Code Here

  @Test
  public void should_create_error_message() {
    Map<?, ?> map = newMap(entry("name", "Yoda"), entry("color", "green"));
    ErrorMessageFactory factory = shouldNotContainValue(map, "green");
    String message = factory.create(new TextDescription("Test"));
    assertEquals("[Test] expecting:\n" + "<{'name'='Yoda', 'color'='green'}>\n" + " not to contain value:\n"
        + "<'green'>", message);
  }
View Full Code Here

  @Test
  public void should_create_error_message() {
    Map<?, ?> map = newMap(entry("name", "Yoda"), entry("color", "green"));
    ErrorMessageFactory factory = shouldContainValue(map, "VeryOld");
    String message = factory.create(new TextDescription("Test"));
    assertEquals("[Test] expecting:\n" + "<{'name'='Yoda', 'color'='green'}>\n" + " to contain value:\n"
        + "<'VeryOld'>", message);
  }
View Full Code Here

    factory = shouldEndWith(newArrayList("Yoda", "Luke"), newArrayList("Han", "Leia"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"));
    assertEquals("[Test] expecting:\n<['Yoda', 'Luke']> to end with:<['Han', 'Leia']>", message);
  }
View Full Code Here

    factory = shouldBeNullOrEmpty(newArrayList("Luke", "Yoda"));
  }

  @Test
  public void should_create_error_message() {
    String message = factory.create(new TextDescription("Test"));
    assertEquals("[Test] expecting:\n null or empty but was:<['Luke', 'Yoda']>", message);
  }
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

TOP

Related Classes of org.fest.assertions.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.