VirtualFileGist<String> (int maxSize, @Nullable IntRef invocationCounter) { String gistId = getTestName(true) + ".gistOfFirst" + maxSize + "CharsFromFile"; int gistVersion = 0; VirtualFileGist.GistCalculator<String> calculator = (p, f) -> { final String content = LoadTextUtil.loadText(f).toString(); return content.substring(0, Math.min(maxSize, content.length())); }; return GistManager.getInstance().newVirtualFileGist( gistId, gistVersion, EnumeratorStringDescriptor.INSTANCE, invocationCounter == null ? calculator : wrapWithCounter(calculator, invocationCounter) ); }