Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhalbritter committed Feb 17, 2022
1 parent c633b85 commit 896345d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,6 @@
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.mock.env.MockEnvironment;

Expand Down Expand Up @@ -68,8 +67,7 @@ void setup() {
@Test
void importsAreSelectedWhenUsingEnableAutoConfiguration() {
String[] imports = selectImports(BasicEnableAutoConfiguration.class);
assertThat(imports).hasSameSizeAs(
SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, getClass().getClassLoader()));
assertThat(imports).hasSameSizeAs(getAutoConfigurationClassNames());
assertThat(this.importSelector.getLastEvent().getExclusions()).isEmpty();
}

Expand Down Expand Up @@ -214,7 +212,7 @@ private String[] selectImports(Class<?> source) {
}

private List<String> getAutoConfigurationClassNames() {
return SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class, getClass().getClassLoader());
return new AutoConfigurationLoader().loadNames(AutoConfiguration.class, getClass().getClassLoader());
}

private class TestAutoConfigurationImportSelector extends AutoConfigurationImportSelector {
Expand Down

0 comments on commit 896345d

Please sign in to comment.