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 get_all_classes_by_LocationProvider() {
        JavaClasses classes = cache.getClassesToAnalyzeFor(TestClass.class, new TestAnalysisRequest()
                .withPackagesRoots(ClassCacheTest.class)
                .withLocationProviders(TestLocationProviderOfClass_String.class, TestLocationProviderOfClass_Rule.class));

        assertThatTypes(classes).contain(String.class, Rule.class, getClass());

        classes = cache.getClassesToAnalyzeFor(TestClassWithLocationProviderUsingTestClass.class,
                analyzeLocation(LocationOfClass.Provider.class));

        assertThatTypes(classes).contain(String.class);
        assertThatTypes(classes).doNotContain(getClass());
    }