@Test public void testGetImapSequenceValues() { String[] expected; List<String> actual; expected = new String[] {"1"}; actual = ImapUtility.getImapSequenceValues("1"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"2147483648"}; actual = ImapUtility.getImapSequenceValues("2147483648"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"4294967295"}; actual = ImapUtility.getImapSequenceValues("4294967295"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"1", "3", "2"}; actual = ImapUtility.getImapSequenceValues("1,3,2"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"4", "5", "6"}; actual = ImapUtility.getImapSequenceValues("4:6"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"9", "8", "7"}; actual = ImapUtility.getImapSequenceValues("9:7"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"1", "2", "3", "4", "9", "8", "7"}; actual = ImapUtility.getImapSequenceValues("1,2:4,9:7"); assertArrayEquals(expected, actual.toArray()); expected = new String[] {"2147483646", "2147483647", "2147483648"}; actual = ImapUtility.getImapSequenceValues("2147483646:2147483648"); assertArrayEquals(expected, actual.toArray()); expected = new String[] { "1", "5" }; actual = ImapUtility.getImapSequenceValues("1,x,5"); assertArrayEquals(expected, actual.toArray()); expected = new String[] { "1", "2", "3" }; actual = ImapUtility.getImapSequenceValues("a:d,1:3"); assertArrayEquals(expected, actual.toArray()); expected = new String[0]; actual = ImapUtility.getImapSequenceValues(""); assertArrayEquals(expected, actual.toArray()); expected = new String[0]; actual = ImapUtility.getImapSequenceValues(null); assertArrayEquals(expected, actual.toArray()); expected = new String[0]; actual = ImapUtility.getImapSequenceValues("a"); assertArrayEquals(expected, actual.toArray()); expected = new String[0]; actual = ImapUtility.getImapSequenceValues("1:x"); assertArrayEquals(expected, actual.toArray()); expected = new String[0]; actual = ImapUtility.getImapSequenceValues("4294967296:4294967297"); assertArrayEquals(expected, actual.toArray()); expected = new String[0]; actual = ImapUtility.getImapSequenceValues("4294967296"); assertArrayEquals(expected, actual.toArray()); }
public static List<String> getImapSequenceValues(String set) { List<String> list = new ArrayList<String>(); if (set != null) { String[] setItems = set.split(","); for (String item : setItems) { if (item.indexOf(':') == -1) { if (isNumberValid(item)) { list.add(item); } } else { list.addAll(getImapRangeValues(item)); } } } return list; }
ImapUtility { public static List<String> getImapSequenceValues(String set) { List<String> list = new ArrayList<String>(); if (set != null) { String[] setItems = set.split(","); for (String item : setItems) { if (item.indexOf(':') == -1) { if (isNumberValid(item)) { list.add(item); } } else { list.addAll(getImapRangeValues(item)); } } } return list; } }
ImapUtility { public static List<String> getImapSequenceValues(String set) { List<String> list = new ArrayList<String>(); if (set != null) { String[] setItems = set.split(","); for (String item : setItems) { if (item.indexOf(':') == -1) { if (isNumberValid(item)) { list.add(item); } } else { list.addAll(getImapRangeValues(item)); } } } return list; }  }
ImapUtility { public static List<String> getImapSequenceValues(String set) { List<String> list = new ArrayList<String>(); if (set != null) { String[] setItems = set.split(","); for (String item : setItems) { if (item.indexOf(':') == -1) { if (isNumberValid(item)) { list.add(item); } } else { list.addAll(getImapRangeValues(item)); } } } return list; }  static List<String> getImapSequenceValues(String set); static List<String> getImapRangeValues(String range); static String encodeString(String str); static ImapResponse getLastResponse(List<ImapResponse> responses); }
ImapUtility { public static List<String> getImapSequenceValues(String set) { List<String> list = new ArrayList<String>(); if (set != null) { String[] setItems = set.split(","); for (String item : setItems) { if (item.indexOf(':') == -1) { if (isNumberValid(item)) { list.add(item); } } else { list.addAll(getImapRangeValues(item)); } } } return list; }  static List<String> getImapSequenceValues(String set); static List<String> getImapRangeValues(String range); static String encodeString(String str); static ImapResponse getLastResponse(List<ImapResponse> responses);  }