@Test public void testEmptyContent() { final String content = ""; final Imports imports = ImportsParser.parseImports(content); assertNotNull(imports); assertTrue(imports.getImports().isEmpty()); }
public static Imports parseImports(final String content) { Imports imports = new Imports(); if (content == null || content.trim().equals("")) { return imports; } else { final String[] lines = content.split("\\n"); for (String line1 : lines) { String line = line1.trim(); if (line.startsWith(KEYWORD)) { line = line.substring(KEYWORD.length()).trim(); if (line.endsWith(";")) { line = line.substring(0, line.length() - 1); } imports.addImport(new Import(line)); } } return imports; } }
ImportsParser { public static Imports parseImports(final String content) { Imports imports = new Imports(); if (content == null || content.trim().equals("")) { return imports; } else { final String[] lines = content.split("\\n"); for (String line1 : lines) { String line = line1.trim(); if (line.startsWith(KEYWORD)) { line = line.substring(KEYWORD.length()).trim(); if (line.endsWith(";")) { line = line.substring(0, line.length() - 1); } imports.addImport(new Import(line)); } } return imports; } } }
ImportsParser { public static Imports parseImports(final String content) { Imports imports = new Imports(); if (content == null || content.trim().equals("")) { return imports; } else { final String[] lines = content.split("\\n"); for (String line1 : lines) { String line = line1.trim(); if (line.startsWith(KEYWORD)) { line = line.substring(KEYWORD.length()).trim(); if (line.endsWith(";")) { line = line.substring(0, line.length() - 1); } imports.addImport(new Import(line)); } } return imports; } } private  ImportsParser(); }
ImportsParser { public static Imports parseImports(final String content) { Imports imports = new Imports(); if (content == null || content.trim().equals("")) { return imports; } else { final String[] lines = content.split("\\n"); for (String line1 : lines) { String line = line1.trim(); if (line.startsWith(KEYWORD)) { line = line.substring(KEYWORD.length()).trim(); if (line.endsWith(";")) { line = line.substring(0, line.length() - 1); } imports.addImport(new Import(line)); } } return imports; } } private  ImportsParser(); static Imports parseImports(final String content); }
ImportsParser { public static Imports parseImports(final String content) { Imports imports = new Imports(); if (content == null || content.trim().equals("")) { return imports; } else { final String[] lines = content.split("\\n"); for (String line1 : lines) { String line = line1.trim(); if (line.startsWith(KEYWORD)) { line = line.substring(KEYWORD.length()).trim(); if (line.endsWith(";")) { line = line.substring(0, line.length() - 1); } imports.addImport(new Import(line)); } } return imports; } } private  ImportsParser(); static Imports parseImports(final String content);  }