MovieNFOReader { private static void parseSets(NodeList nlElements, Movie movie) { Node nElements; for (int looper = 0; looper < nlElements.getLength(); looper++) { nElements = nlElements.item(looper); if (nElements.getNodeType() == Node.ELEMENT_NODE) { Element eId = (Element) nElements; String setOrder = eId.getAttribute("order"); if (StringUtils.isNumeric(setOrder)) { movie.addSet(eId.getTextContent(), Integer.parseInt(setOrder)); } else { movie.addSet(eId.getTextContent()); } } } } private  MovieNFOReader(); static boolean readNfoFile(File nfoFile, Movie movie); static boolean readXmlNfo(String nfoText, Movie movie, String nfoFilename); static boolean readXmlNfo(File nfoFile, Movie movie); static boolean readTextNfo(String nfo, Movie movie); static void movieDate(Movie movie, final String dateString); static void parseRuntime(Element eCommon, Movie movie); static final String TYPE_MOVIE; static final String TYPE_TVSHOW; static final String TYPE_EPISODE; static final String NFO_PLUGIN_ID; }
@Test public void testParseSets() { LOG.info("ParseSets"); StringBuilder nfo = new StringBuilder(); nfo.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); nfo.append("<movie>"); nfo.append("<id>-1</id>"); nfo.append(" <set>\n\r"); nfo.append(" <name>Mission: Impossible Collection</name>\n\r"); nfo.append(" </set>\n\r"); nfo.append("</movie>"); Movie movie = new Movie(); MovieNFOReader.readXmlNfo(nfo.toString(), movie, "test.nfo"); assertEquals("Wrong set amount", 1, movie.getSets().size()); for (String set : movie.getSetsKeys()) { assertEquals("Incorrect set name", "Mission: Impossible Collection", set); } }