From 5a864ccb08f9173d119e9f6e8c77d6e333ee32bc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 14 May 2018 11:47:12 +0100 Subject: [PATCH] JAL-2711 removed unused and flaky utility method --- src/jalview/util/StringUtils.java | 25 +------------------------ test/jalview/util/StringUtilsTest.java | 15 +-------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index 2e8ace8..3c5ba92 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -107,29 +107,6 @@ public class StringUtils } /** - * Returns the last part of 'input' after the last occurrence of 'token'. For - * example to extract only the filename from a full path or URL. - * - * @param input - * @param token - * a delimiter which must be in regular expression format - * @return - */ - public static String getLastToken(String input, String token) - { - if (input == null) - { - return null; - } - if (token == null) - { - return input; - } - String[] st = input.split(token); - return st[st.length - 1]; - } - - /** * Parses the input string into components separated by the delimiter. Unlike * String.split(), this method will ignore occurrences of the delimiter which * are nested within single quotes in name-value pair values, e.g. a='b,c'. @@ -146,7 +123,7 @@ public class StringUtils { return null; } - List jv = new ArrayList(); + List jv = new ArrayList<>(); int cp = 0, pos, escape; boolean wasescaped = false, wasquoted = false; String lstitem = null; diff --git a/test/jalview/util/StringUtilsTest.java b/test/jalview/util/StringUtilsTest.java index 084219a..9d805cc 100644 --- a/test/jalview/util/StringUtilsTest.java +++ b/test/jalview/util/StringUtilsTest.java @@ -87,19 +87,6 @@ public class StringUtilsTest } @Test(groups = { "Functional" }) - public void testGetLastToken() - { - assertNull(StringUtils.getLastToken(null, null)); - assertNull(StringUtils.getLastToken(null, "/")); - assertEquals("a", StringUtils.getLastToken("a", null)); - - assertEquals("abc", StringUtils.getLastToken("abc", "/")); - assertEquals("c", StringUtils.getLastToken("abc", "b")); - assertEquals("file1.dat", StringUtils.getLastToken( - "file://localhost:8080/data/examples/file1.dat", "/")); - } - - @Test(groups = { "Functional" }) public void testSeparatorListToArray() { String[] result = StringUtils.separatorListToArray( @@ -145,7 +132,7 @@ public class StringUtilsTest public void testListToDelimitedString() { assertEquals("", StringUtils.listToDelimitedString(null, ";")); - List list = new ArrayList(); + List list = new ArrayList<>(); assertEquals("", StringUtils.listToDelimitedString(list, ";")); list.add("now"); assertEquals("now", StringUtils.listToDelimitedString(list, ";")); -- 1.7.10.2