ProductionRunContextFactory { @NotNull public static RunContext fromRunDirectory(@NotNull String runDirectory) throws IOException { RunContext runContextFromMetaData = MetaDataResolver.fromMetaDataFile(runDirectory); if (runContextFromMetaData == null) { throw new IOException("Could not resolve run context from meta data for " + runDirectory); } return runContextFromMetaData; } private  ProductionRunContextFactory(); @NotNull static RunContext fromRunDirectory(@NotNull String runDirectory);  }
@Test public void picksMetadataWhenAvailable() throws IOException { String runDirectory = RESOURCE_DIR + File.separator + "RunDirSomatic"; assertNotNull(ProductionRunContextFactory.fromRunDirectory(runDirectory)); }
@Test(expected = IOException.class) public void throwExceptionWhenNoMetaData() throws IOException { String runDirectory = RESOURCE_DIR + File.separator + "DoesNotExist"; assertNotNull(ProductionRunContextFactory.fromRunDirectory(runDirectory)); }