From: gmungoc Date: Mon, 14 Sep 2015 08:43:11 +0000 (+0100) Subject: JAL-1270 test added for separatorListToArray X-Git-Tag: Release_2_10_0~418 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4574c3caf9bbd27eed97f18827a2343f35fc940e;p=jalview.git JAL-1270 test added for separatorListToArray --- diff --git a/test/jalview/bin/JalviewLiteTest.java b/test/jalview/bin/JalviewLiteTest.java new file mode 100644 index 0000000..047aae8 --- /dev/null +++ b/test/jalview/bin/JalviewLiteTest.java @@ -0,0 +1,39 @@ +package jalview.bin; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNull; + +import java.util.Arrays; + +import org.testng.annotations.Test; + + +public class JalviewLiteTest +{ + + @Test(groups = "Functional") + public void testSeparatorListToArray() + { + assertNull(JalviewLite.separatorListToArray(null, "|")); + assertNull(JalviewLite.separatorListToArray("", "|")); + assertNull(JalviewLite.separatorListToArray("|", "|")); + assertNull(JalviewLite.separatorListToArray("abc", "abc")); + + String [] array = JalviewLite.separatorListToArray("abc|def|ghi|", "|"); + assertEquals(3, array.length); + assertEquals("abc", array[0]); + assertEquals("def", array[1]); + assertEquals("ghi", array[2]); + + assertEquals("[abc]", + Arrays.toString(JalviewLite.separatorListToArray("abc|", "|"))); + assertEquals("[abc]", Arrays.toString(JalviewLite.separatorListToArray( + "abcxy", "xy"))); + + // these fail: + // assertEquals("[abc]", + // Arrays.toString(JalviewLite.separatorListToArray("|abc", "|"))); + // assertEquals("[abc]", Arrays.toString(JalviewLite.separatorListToArray( + // "abc|||", "|"))); + } +}