HealthChecksApplication { @VisibleForTesting void run(boolean writeOutput) throws IOException { List<HealthChecker> checkers; if (tumorSample == null || amberDirectory == null || purpleDirectory == null) { LOGGER.info("Running in SingleSample mode"); checkers = Lists.newArrayList(new MetricsChecker(refSample, null, metricsDirectory)); } else { LOGGER.info("Running in Somatic mode"); checkers = Lists.newArrayList(new MetricsChecker(refSample, tumorSample, metricsDirectory), new AmberChecker(tumorSample, amberDirectory), new PurpleChecker(tumorSample, purpleDirectory)); } List<QCValue> qcValues = Lists.newArrayList(); for (final HealthChecker checker : checkers) { qcValues.addAll(checker.run()); } for (QCValue qcValue : qcValues) { LOGGER.info("QC '{}' has value '{}'", qcValue.type(), qcValue.value()); } if (HealthCheckEvaluation.isPass(qcValues)) { LOGGER.info("Health check evaluation succeeded."); if (writeOutput) { new FileOutputStream(fileOutputBasePath() + ".HealthCheckSucceeded").close(); } } else { LOGGER.info("Health check evaluation failed!"); if (writeOutput) { new FileOutputStream(fileOutputBasePath() + ".HealthCheckFailed").close(); } } } @VisibleForTesting  HealthChecksApplication(@NotNull String refSample, @Nullable String tumorSample, @NotNull String metricsDirectory,
            @Nullable String amberDirectory, @Nullable String purpleDirectory, @NotNull String outputDir); static void main(final String... args);  }
@Test public void runHealthCheckerInSomaticMode() throws IOException { HealthChecksApplication app = new HealthChecksApplication("reference", "tumor", BASE_DIR + "metrics", BASE_DIR + "amber", BASE_DIR + "purple", OUTPUT_DIR); app.run(WRITE_OUTPUT); }
@Test public void runHealthCheckerInSingleSampleMode() throws IOException { HealthChecksApplication app = new HealthChecksApplication("reference", null, BASE_DIR + "metrics", null, null, OUTPUT_DIR); app.run(WRITE_OUTPUT); }