|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
|
* Copyright 2012-2021 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.
|
|
|
|
@ -23,6 +23,7 @@ import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.junit.jupiter.api.extension.ExtendWith;
|
|
|
|
|
import org.mockito.Mock;
|
|
|
|
@ -68,6 +69,17 @@ class ConfigDataLocationResolversTests {
|
|
|
|
|
|
|
|
|
|
private ResourceLoader resourceLoader = new DefaultResourceLoader();
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void createWhenInjectingLogAndDeferredLogFactoryCreatesResolver() {
|
|
|
|
|
ConfigDataLocationResolvers resolvers = new ConfigDataLocationResolvers(this.logFactory, this.bootstrapContext,
|
|
|
|
|
this.binder, this.resourceLoader, Collections.singletonList(TestLogResolver.class.getName()));
|
|
|
|
|
assertThat(resolvers.getResolvers()).hasSize(1);
|
|
|
|
|
assertThat(resolvers.getResolvers().get(0)).isExactlyInstanceOf(TestLogResolver.class);
|
|
|
|
|
TestLogResolver resolver = (TestLogResolver) resolvers.getResolvers().get(0);
|
|
|
|
|
assertThat(resolver.getDeferredLogFactory()).isSameAs(this.logFactory);
|
|
|
|
|
assertThat(resolver.getLog()).isNotNull();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void createWhenInjectingBinderCreatesResolver() {
|
|
|
|
|
ConfigDataLocationResolvers resolvers = new ConfigDataLocationResolvers(this.logFactory, this.bootstrapContext,
|
|
|
|
@ -180,6 +192,27 @@ class ConfigDataLocationResolversTests {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class TestLogResolver extends TestResolver {
|
|
|
|
|
|
|
|
|
|
private final DeferredLogFactory deferredLogFactory;
|
|
|
|
|
|
|
|
|
|
private final Log log;
|
|
|
|
|
|
|
|
|
|
TestLogResolver(DeferredLogFactory deferredLogFactory, Log log) {
|
|
|
|
|
this.deferredLogFactory = deferredLogFactory;
|
|
|
|
|
this.log = log;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DeferredLogFactory getDeferredLogFactory() {
|
|
|
|
|
return this.deferredLogFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Log getLog() {
|
|
|
|
|
return this.log;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static class TestBoundResolver extends TestResolver {
|
|
|
|
|
|
|
|
|
|
private final Binder binder;
|
|
|
|
|