PurpleChecker implements HealthChecker { @NotNull @Override public List<QCValue> run() throws IOException { String path = PurpleQCFile.generateFilename(purpleDirectory, tumorSample); List<String> lines = LineReader.build().readLines(new File(path).toPath(), x -> x.contains("QCStatus")); assert lines.size() == 1; String[] parts = lines.get(0).split("\t"); return Lists.newArrayList(ImmutableQCValue.of(QCValueType.PURPLE_QC_STATUS, parts[1])); } PurpleChecker(@NotNull final String tumorSample, @NotNull final String purpleDirectory); @NotNull @Override List<QCValue> run();  }
@Test public void extractDataFromPurpleWorksForSomatic() throws IOException { PurpleChecker checker = new PurpleChecker("tumor", PURPLE_DIRECTORY); List<QCValue> values = checker.run(); assertEquals(QCValueType.PURPLE_QC_STATUS, values.get(0).type()); assertEquals("FAIL_GENDER", values.get(0).value()); }
@Test(expected = IOException.class) public void malformedYieldsIOException() throws IOException { PurpleChecker checker = new PurpleChecker("malformed", PURPLE_DIRECTORY); checker.run(); }
@Test(expected = IOException.class) public void missingYieldsIOException() throws IOException { PurpleChecker checker = new PurpleChecker("missing", PURPLE_DIRECTORY); checker.run(); }