Merge branch '1.4.x' into 1.5.x
This commit is contained in:
@@ -24,7 +24,6 @@ import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.test.context.BootstrapWith;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -83,9 +82,4 @@ public class SpringBootTestContextBootstrapperIntegrationTests {
|
||||
|
||||
}
|
||||
|
||||
@Component
|
||||
static class ExampleTestComponent {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -169,6 +169,8 @@ public class DefinitionsParserTests {
|
||||
QualifierDefinition qualifier = QualifierDefinition.forElement(
|
||||
ReflectionUtils.findField(SpyBeanOnClassAndField.class, "caller"));
|
||||
assertThat(fieldDefinition.getQualifier()).isNotNull().isEqualTo(qualifier);
|
||||
assertThat(fieldDefinition.getTypeToSpy().resolve())
|
||||
.isEqualTo(ExampleServiceCaller.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -36,6 +36,9 @@ import static org.mockito.Mockito.verify;
|
||||
/**
|
||||
* Test {@link MockBean} on a test class field can be used to replace existing bean while
|
||||
* preserving qualifiers.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
public class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
||||
|
||||
@@ -21,6 +21,11 @@ import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
/**
|
||||
* Custom qualifier for testing.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@Qualifier
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CustomQualifier {
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.mock.mockito.example;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
@Target({ ElementType.TYPE, ElementType.FIELD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@MockBean
|
||||
public @interface MyMockBean {
|
||||
|
||||
@AliasFor(annotation = MockBean.class, attribute = "value")
|
||||
Class<?> value();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user