LanguagePackBuilder extends AbstractLiveFileBuilder { @Override public void build(Path poFile) throws IOException { write( Paths.get(poFile.toString().replace(".po", ".json")), languagePackFactory.create(poFile.toFile()).toJson()); } @Inject  LanguagePackBuilder(Watcher watcher, LanguagePackFactory languagePackFactory); @Override void build(Path poFile); @Override boolean isBuildable(String path);  }
@Test public void should_replace_a_previous_build_with_new_one() throws Exception { File poFile = folder.newFile("file.po"); File jsonFile = new File(poFile.getPath().replace(".po", ".json")); write(poFile.toPath(), aSimplePoFile()); write(jsonFile.toPath(), "previous content".getBytes()); builder.build(poFile.toPath()); assertThat(read(jsonFile)).isEqualTo("{\"francais\":{\"A page\":\"Une page\"}}"); }