JAL-1645 source formatting and organise imports
[jalview.git] / test / jalview / util / StringUtilsTest.java
index e8de3bd..ece1fda 100644 (file)
@@ -11,16 +11,14 @@ import org.testng.annotations.Test;
 public class StringUtilsTest
 {
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testInsertCharAt()
   {
     char[] c1 = "ABC".toCharArray();
-    char[] expected = new char[]
-    { 'A', 'B', 'C', 'w', 'w' };
+    char[] expected = new char[] { 'A', 'B', 'C', 'w', 'w' };
     assertTrue(Arrays.equals(expected,
             StringUtils.insertCharAt(c1, 3, 2, 'w')));
-    expected = new char[]
-    { 'A', 'B', 'C', 'w', 'w' };
+    expected = new char[] { 'A', 'B', 'C', 'w', 'w' };
     assertTrue(Arrays.equals(expected,
             StringUtils.insertCharAt(c1, 4, 2, 'w')));
     assertTrue(Arrays.equals(expected,
@@ -31,32 +29,32 @@ public class StringUtilsTest
             StringUtils.insertCharAt(c1, 7, 2, 'w')));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testDeleteChars()
   {
     char[] c1 = "ABC".toCharArray();
 
     // delete second position
-    assertTrue(Arrays.equals(new char[]
-    { 'A', 'C' }, StringUtils.deleteChars(c1, 1, 2)));
+    assertTrue(Arrays.equals(new char[] { 'A', 'C' },
+            StringUtils.deleteChars(c1, 1, 2)));
 
     // delete positions 1 and 2
-    assertTrue(Arrays.equals(new char[]
-    { 'C' }, StringUtils.deleteChars(c1, 0, 2)));
+    assertTrue(Arrays.equals(new char[] { 'C' },
+            StringUtils.deleteChars(c1, 0, 2)));
 
     // delete positions 1-3
-    assertTrue(Arrays.equals(new char[]
-    {}, StringUtils.deleteChars(c1, 0, 3)));
+    assertTrue(Arrays.equals(new char[] {},
+            StringUtils.deleteChars(c1, 0, 3)));
 
     // delete position 3
-    assertTrue(Arrays.equals(new char[]
-    { 'A', 'B' }, StringUtils.deleteChars(c1, 2, 3)));
+    assertTrue(Arrays.equals(new char[] { 'A', 'B' },
+            StringUtils.deleteChars(c1, 2, 3)));
 
     // out of range deletion is ignore
     assertTrue(Arrays.equals(c1, StringUtils.deleteChars(c1, 3, 4)));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testGetLastToken()
   {
     assertNull(StringUtils.getLastToken(null, null));
@@ -69,7 +67,7 @@ public class StringUtilsTest
             "file://localhost:8080/data/examples/file1.dat", "/"));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testSeparatorListToArray()
   {
     String[] result = StringUtils.separatorListToArray(
@@ -81,7 +79,7 @@ public class StringUtilsTest
      */
     result = StringUtils.separatorListToArray("minsize='2', sep=','", ",");
     assertEquals("[minsize='2',  sep=',']", Arrays.toString(result));
-    
+
     /*
      * String delimited by | containing a quoted | (should not be treated as
      * delimiter)
@@ -90,18 +88,22 @@ public class StringUtilsTest
             .separatorListToArray("abc='|'d|ef|g", "|")));
   }
 
-  @Test(groups ={ "Functional" })
+  @Test(groups = { "Functional" })
   public void testArrayToSeparatorList()
   {
     assertEquals("*", StringUtils.arrayToSeparatorList(null, "*"));
-    assertEquals("*", StringUtils.arrayToSeparatorList(new String[]
-    {}, "*"));
-    assertEquals("a*bc*cde", StringUtils.arrayToSeparatorList(new String[]
-    { "a", "bc", "cde" }, "*"));
-    assertEquals("a*cde", StringUtils.arrayToSeparatorList(new String[]
-    { "a", null, "cde" }, "*"));
-    assertEquals("a**cde", StringUtils.arrayToSeparatorList(new String[]
-    { "a", "", "cde" }, "*"));
+    assertEquals("*",
+            StringUtils.arrayToSeparatorList(new String[] {}, "*"));
+    assertEquals(
+            "a*bc*cde",
+            StringUtils.arrayToSeparatorList(new String[] { "a", "bc",
+                "cde" }, "*"));
+    assertEquals(
+            "a*cde",
+            StringUtils.arrayToSeparatorList(new String[] { "a", null,
+                "cde" }, "*"));
+    assertEquals("a**cde", StringUtils.arrayToSeparatorList(new String[] {
+        "a", "", "cde" }, "*"));
     // delimiter within token is not (yet) escaped
     assertEquals("a*b*c*cde", StringUtils.arrayToSeparatorList(new String[]
     { "a", "b*c", "cde" }, "*"));