c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * CDDL HEADER START
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * The contents of this file are subject to the terms of the
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * Common Development and Distribution License, Version 1.0 only
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * (the "License"). You may not use this file except in compliance
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * with the License.
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * or http://forgerock.org/license/CDDLv1.0.html.
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * See the License for the specific language governing permissions
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * and limitations under the License.
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * When distributing Covered Code, include this CDDL HEADER in each
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * file and include the License file at legal-notices/CDDLv1_0.txt.
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * If applicable, add the following below this CDDL HEADER, with the
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * fields enclosed by brackets "[]" replaced with your own identifying
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * information:
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * Portions Copyright [yyyy] [name of copyright owner]
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * CDDL HEADER END
05b42f00b813c3dc70cbb80d62089f9cc0f6f549ludovicp * Copyright 2006-2008 Sun Microsystems, Inc.
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter * Utils Tester.
24d6db06810f2ea747f6dff60d483e4fca3aaa13davidelypublic class UtilsTest extends DirectoryServerTestCase {
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter // Test data should not contain words longer that
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter // the maximum line length value.
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter return new Object[][]{
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter "Hi my<br>name<br>is<br>Bingo"},
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter "Hi<br>my<br>name<br>is<br>Bingo"},
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter "Hi<br>my<br>name<br>is<br>Bingo"},
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter public void testBreakHtmlString(String s, int maxll, String expectedValue) {
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter assertTrue(Utils.breakHtmlString(s, maxll).equals(expectedValue));
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter return new Object[][]{
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter {"Hi<input value=\"abc\"></input> Ho", "Hi Ho"},
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter // {"Hi<tag attr=\"1 > 0\"> Ho", "Hi Ho"}, // broken case
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter // {"Hi <your name here>", "Hi <your name here>"} // broken case
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter @Test(enabled = false, dataProvider = "stripHtmlData")
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter public void testStripHtml(String html, String expectedResult) {
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter assertTrue(expectedResult.equals(Utils.stripHtml(html)));
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter return new Object[][]{
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter {"Hi <i>Ho</i>", true},
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter // {"Hello <your name here>", false}, // broken case
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter @Test(enabled = false, dataProvider = "containsHtmlData")
c4872f44c4ebc3317f3cb6bd44baf674f18e0088kenneth_suter public void testContainsHtml(String s, boolean expectedResult) {