Merge branch 'Jalview-JS/develop' into merge_js_develop
[jalview.git] / test / jalview / util / PlatformTest.java
index d2c48f1..49f1335 100644 (file)
@@ -32,6 +32,7 @@ import java.awt.Toolkit;
 import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
 
+import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
@@ -141,4 +142,17 @@ public class PlatformTest
     assertEquals(Platform.escapeBackslashes("hello world"), "hello world");
     assertEquals(Platform.escapeBackslashes("hello\\world"), "hello\\\\world");
   }
+
+  @Test(groups = { "Functional" })
+  public void getLeadingIntegerFromString()
+  {
+    Assert.assertEquals(Platform.getLeadingIntegerValue("1234abcd", -1),
+            1234);
+    Assert.assertEquals(Platform.getLeadingIntegerValue("1234", -1), 1234);
+    Assert.assertEquals(Platform.getLeadingIntegerValue("abcd", -1), -1);
+    Assert.assertEquals(Platform.getLeadingIntegerValue("abcd1234", -1),
+            -1);
+    Assert.assertEquals(Platform.getLeadingIntegerValue("None", -1), -1);
+    Assert.assertEquals(Platform.getLeadingIntegerValue("Null", -1), -1);
+  }
 }