}
}
@Test
public void testSettingOutputCharacterEncoding() throws Exception {
SpecificCompiler compiler = createCompiler();
// Generated file in default encoding
compiler.compileToDestination(this.src, this.outputDir);
byte[] fileInDefaultEncoding = new byte[(int) this.outputFile.length()];
new FileInputStream(this.outputFile).read(fileInDefaultEncoding);
this.outputFile.delete();
// Generate file in another encoding (make sure it has different number of bytes per character)
String differentEncoding = Charset.defaultCharset().equals(Charset.forName("UTF-16")) ? "UTF-32" : "UTF-16";
compiler.setOutputCharacterEncoding(differentEncoding);
compiler.compileToDestination(this.src, this.outputDir);
byte[] fileInDifferentEncoding = new byte[(int) this.outputFile.length()];
new FileInputStream(this.outputFile).read(fileInDifferentEncoding);
// Compare as bytes
assertThat("Generated file should contain different bytes after setting non-default encoding",
fileInDefaultEncoding, not(equalTo(fileInDifferentEncoding)));