@Test public void emptyWidsTest() { List<WorkItemDefinition> defs = WorkItemDefinitionClientParser.parse(""); assertTrue(defs.isEmpty()); defs = WorkItemDefinitionClientParser.parse("[]"); assertTrue(defs.isEmpty()); defs = WorkItemDefinitionClientParser.parse("[\n]"); assertTrue(defs.isEmpty()); defs = WorkItemDefinitionClientParser.parse(null); assertTrue(defs.isEmpty()); }
public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }
WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; } }
WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }  }
WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }  static List<WorkItemDefinition> parse(String widStr); }
WorkItemDefinitionClientParser { public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }  static List<WorkItemDefinition> parse(String widStr);  }