FastqStatsRunner { @NotNull @VisibleForTesting static String getFlowcellName(@NotNull final String dirPath) { final File runInfoXml = new File(dirPath + File.separator + "RunInfo.xml"); final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); try { final DocumentBuilder documentBuilder = domFactory.newDocumentBuilder(); final Document xmlDoc = documentBuilder.parse(runInfoXml); final XPath xPath = XPathFactory.newInstance().newXPath(); return (String) xPath.evaluate(" } catch (Exception e) { LOGGER.warn("Could not extract flowcell name from {}", runInfoXml.getPath()); return "Unknown"; } }  static void main(String[] args);  }
@Test public void extractsCorrectFlowcellName() { final String flowcellName = FastqStatsRunner.getFlowcellName(RUN_DIR_PATH); assertEquals("TESTFLOWCELL", flowcellName); }
@Test public void returnsUnknownFlowcellName() { final String flowcellName = FastqStatsRunner.getFlowcellName("whoops"); assertEquals("Unknown", flowcellName); }