Crossfire JXClient, Trunk  R20561
StringSplitterTest.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.util;
23 
24 import org.junit.Assert;
25 import org.junit.Test;
26 
31 public class StringSplitterTest {
32 
36  @Test
37  public void testSplit() {
38  Assert.assertEquals("", StringSplitter.splitAsHtml(""));
39  Assert.assertEquals("a", StringSplitter.splitAsHtml("a"));
40  Assert.assertEquals("abc", StringSplitter.splitAsHtml("abc"));
41  Assert.assertEquals("a b c", StringSplitter.splitAsHtml("a b c"));
42  Assert.assertEquals("a b c", StringSplitter.splitAsHtml(" a b c "));
43 
44  Assert.assertEquals("a b c d e f g h i j k l m n o p q r s t u v w x y<br>"+"A B C D E", StringSplitter.splitAsHtml("a b c d e f g h i j k l m n o p q r s t u v w x y A B C D E"));
45  Assert.assertEquals("a b c d e f g h i j k l m n o p q r s t u v w x y<br>"+"A B C D E F G H I J K L M N O P Q R S T U V W X Y<br>"+"a b c d e f g h i j k l m n o p q r s t u v w x y<br>"+"A B C D E", StringSplitter.splitAsHtml("a b c d e f g h i j k l m n o p q r s t u v w x y A B C D E F G H I J K L M N O P Q R S T U V W X Y a b c d e f g h i j k l m n o p q r s t u v w x y A B C D E"));
46  Assert.assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br>"+"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb<br>"+"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc<br>"+"cccccccccccccccccccc ddddddddddddddddddddddddddddd<br>"+"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee<br>"+"ffffffffffffffffffffffffffffff<br>"+"gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg<br>"+"gggggggggggggggggggg", StringSplitter.splitAsHtml("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ddddddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ffffffffffffffffffffffffffffff gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"));
47  }
48 
49 }
void testSplit()
Checks that StringSplitter#splitAsHtml(String) does work.
static String splitAsHtml(@NotNull final String message)
Splits the given string into lines and returns the lines separated by "&lt;br&gt;".
Utility class for splitting strings.
Regression tests for class StringSplitter.