JavaClasses getClassesToAnalyzeFor(Class<?> testClass, ClassAnalysisRequest classAnalysisRequest) {
        checkNotNull(testClass);
        checkNotNull(classAnalysisRequest);

        if (cachedByTest.containsKey(testClass)) {
            return cachedByTest.get(testClass);
        }

        LocationsKey locations = RequestedLocations.by(classAnalysisRequest, testClass).asKey();

        JavaClasses classes = classAnalysisRequest.getCacheMode() == FOREVER
                ? cachedByLocations.getUnchecked(locations).get()
                : new LazyJavaClasses(locations.locations, locations.importOptionTypes).get();

        cachedByTest.put(testClass, classes);
        return classes;
    }
@Test
    public void if_whole_classpath_is_set_true_then_the_whole_classpath_is_imported() {
        TestAnalysisRequest defaultOptions = new TestAnalysisRequest().withWholeClasspath(true);
        Class<?>[] expectedImportResult = new Class[]{getClass()};
        doReturn(new ClassFileImporter().importClasses(expectedImportResult))
                .when(cacheClassFileImporter).importClasses(anySet(), anyCollection());

        JavaClasses classes = cache.getClassesToAnalyzeFor(TestClass.class, defaultOptions);

        assertThatTypes(classes).matchExactly(expectedImportResult);
        verify(cacheClassFileImporter).importClasses(anySet(), locationCaptor.capture());
        assertThat(locationCaptor.getValue())
                .has(locationContaining("archunit"))
                .has(locationContaining("asm"))
                .has(locationContaining("google"))
                .has(locationContaining("mockito"));
    }