void () { final VirtualFile file = createFile("A.java"); assertEquals(getProjectDefault(), file.getCharset()); EncodingProjectManager.getInstance(myProject).setEncoding(file, WINDOWS_1251); assertSameElements(getService().getAllModuleEncodings(myModule), projectDefaultPlus(WINDOWS_1251)); assertEquals(WINDOWS_1251, getService().getPreferredModuleEncoding(myModule)); EncodingProjectManager.getInstance(myProject).setEncoding(file.getParent(), WINDOWS_1252); assertSameElements(getService().getAllModuleEncodings(myModule), WINDOWS_1251, WINDOWS_1252); assertEquals(WINDOWS_1252, getService().getPreferredModuleEncoding(myModule)); }