void () { loadProject("/jps/jps-builders/testData/compilerEncoding/compilerEncoding.ipr"); JpsEncodingProjectConfiguration projectConfig = JpsEncodingConfigurationService.getInstance().getEncodingConfiguration(myProject); assertNotNull(projectConfig); assertEncoding("UTF-8", "moduleA/src/dir/with-encoding.xml", projectConfig); // overridden by file's internal encoding assertEncoding("windows-1251", "moduleA/src/dir/with-encoding.txt", projectConfig); assertEncoding("UTF-8", "moduleA/src/dir/without-encoding.xml", projectConfig); assertEncoding("UTF-8", "moduleA/src/dir/without-encoding.txt", projectConfig); assertEncoding("UTF-8", "moduleA/src/dir/non-existent.xml", projectConfig); assertEncoding("windows-1252", "moduleB/src/non-existent.xml", projectConfig); final CompilerEncodingConfiguration compilerEncodingConfiguration = new CompilerEncodingConfiguration(myModel, myRootIndex); for (JpsModule module : myProject.getModules()) { final String moduleEncoding = compilerEncodingConfiguration.getPreferredModuleEncoding(module); if ("moduleA".equals(module.getName())) { assertEquals("UTF-8", moduleEncoding); } else if ("moduleB".equals(module.getName())) { assertNull(moduleEncoding); } else if ("moduleC".equals(module.getName())) { assertEquals("windows-1252", moduleEncoding); } else { fail("Unexpected module in project: " + module.getName()); } } }