void () { AtomicInteger lookupCalls = new AtomicInteger(); UnknownSdkResolver.EP_NAME.getPoint().registerExtension(new UnknownSdkResolver() { @Override public boolean supportsResolution(@NotNull SdkTypeId sdkTypeId) { return true; } @Override public @Nullable UnknownSdkLookup createResolver(@Nullable Project project, @NotNull ProgressIndicator indicator) { lookupCalls.incrementAndGet(); return null; } }, getTestRootDisposable()); setModuleSdk("foo-bar-baz", JavaSdk.getInstance()); detectMissingSdks(); detectMissingSdks(); detectMissingSdks(); assertThat(lookupCalls).hasValue(1); //do the same change setModuleSdk("foo-bar-baz", JavaSdk.getInstance()); detectMissingSdks(); detectMissingSdks(); detectMissingSdks(); //it must not re-compute it assertThat(lookupCalls).hasValue(1); //change it finally setModuleSdk("foo-bar-baz-NEW", JavaSdk.getInstance()); detectMissingSdks(); detectMissingSdks(); detectMissingSdks(); //it must not re-compute it assertThat(lookupCalls).hasValue(2); }