TaskGenerateIndexTs extends AbstractTaskClientGenerator { @Override protected String getFileContent() throws IOException { String indexTemplate = IOUtils .toString(getClass().getResourceAsStream(INDEX_TS), UTF_8); String relativizedImport = ensureValidRelativePath( FrontendUtils.getUnixRelativePath(outputDirectory.toPath(), generatedImports.toPath())); relativizedImport = relativizedImport .replaceFirst("^./", "../" + outputDirectory.getName() + "/") .replaceFirst("\\.(ts|js)$", ""); return indexTemplate.replace("[to-be-generated-by-flow]", relativizedImport); } TaskGenerateIndexTs(File frontendDirectory, File generatedImports,
            File outputDirectory);   }
@Test public void replacedImport_should_beRelativeTo_targetAndFrontend() throws Exception { String content = taskGenerateIndexTs.getFileContent(); Assert.assertTrue(content.contains("import('../target/frontend/flow-generated-imports'")); }