@Test public void defaultSettings() { NativeJavaCompilerSettings settings = new NativeJavaCompilerSettings(); List<String> options = settings.toOptionsList(); Assertions.assertThat(options).hasSize(6); Assertions.assertThat(options).contains("-source", "-target", "-encoding"); // check the order is correct, value of the option needs to be right after the option name Assertions.assertThat(options).contains("1.8", Index.atIndex(options.indexOf("-source") + 1)); Assertions.assertThat(options).contains("1.8", Index.atIndex(options.indexOf("-target") + 1)); Assertions.assertThat(options).contains("UTF-8", Index.atIndex(options.indexOf("-encoding") + 1)); }
@Test public void allSettings() { NativeJavaCompilerSettings settings = new NativeJavaCompilerSettings(); settings.setDebug(true); settings.setWarnings(true); settings.setDeprecations(true); settings.setSourceEncoding("My-Custom-Encoding"); settings.setSourceVersion("1.9"); settings.setTargetVersion("1.9"); List<String> options = settings.toOptionsList(); Assertions.assertThat(options).hasSize(9); Assertions.assertThat(options).contains("-g"); Assertions.assertThat(options).contains("-Xlint:all"); Assertions.assertThat(options).contains("-deprecation"); // check the order is correct, value of the option needs to be right after the option name Assertions.assertThat(options).contains("1.9", Index.atIndex(options.indexOf("-source") + 1)); Assertions.assertThat(options).contains("1.9", Index.atIndex(options.indexOf("-target") + 1)); Assertions.assertThat(options).contains("My-Custom-Encoding", Index.atIndex(options.indexOf("-encoding") + 1)); }