void () { IdempotenceChecker.disableRandomChecksUntil(getTestRootDisposable()); PsiFile file = myFixture.addFileToProject("a.txt", ""); AtomicInteger recomputations = new AtomicInteger(); CachedValue<String> cv = CachedValuesManager.getManager(getProject()).createCachedValue(() -> { recomputations.incrementAndGet(); return CachedValueProvider.Result.create("x", file); }); assertEquals("x", cv.getValue()); assertEquals(1, recomputations.get()); myFixture.addFileToProject("b.txt", ""); assertEquals("x", cv.getValue()); assertEquals(1, recomputations.get()); }