void (@NotNull String content, @NotNull VirtualFile vFile, @NotNull Document document) { Charset charset = EncodingProjectManager.getInstance(getProject()).getEncoding(vFile, false); float bytesPerChar = charset == null ? 2 : charset.newEncoder().averageBytesPerChar(); int contentSize = (int)(FileUtilRt.LARGE_FILE_PREVIEW_SIZE / bytesPerChar); String substring = content.substring(0, contentSize); assertEquals(substring, document.getText()); }