void () { myFixture.configureByFile(getTestName(false) + ".java"); final VirtualFile vFile = myFixture.getFile().getVirtualFile(); Charset ascii = StandardCharsets.US_ASCII; EncodingProjectManager.getInstance(getProject()).setEncoding(vFile, ascii); UIUtil.dispatchAllInvocationEvents(); // reload in invokeLater assertEquals(ascii, vFile.getCharset()); myFixture.testHighlighting(true, false, false); }