예제 #1
0
  /*
   * def test_truncatewords
   *   assert_equal 'one two three', @filters.truncatewords('one two three', 4)
   *   assert_equal 'one two...', @filters.truncatewords('one two three', 2)
   *   assert_equal 'one two three', @filters.truncatewords('one two three')
   *   assert_equal 'Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13”...',
   *                 @filters.truncatewords('Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13” x 16” x 10.5” high) with cover.', 15)
   * end
   */
  @Test
  public void applyOriginalTest() {

    final Filter filter = Filter.getFilter("truncatewords");

    assertThat(filter.apply("one two three", 4), is((Object) "one two three"));
    assertThat(filter.apply("one two three", 2), is((Object) "one two..."));
    assertThat(filter.apply("one two three", 3), is((Object) "one two three"));
    assertThat(
        filter.apply(
            "Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13” x 16” x 10.5” high) with cover.",
            15),
        is(
            (Object)
                "Two small (13” x 5.5” x 10” high) baskets fit inside one large basket (13”..."));
  }