diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java index ef53d39d99..4f76b9f6df 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java @@ -105,7 +105,7 @@ public @interface MockBean { * When {@code @MockBean} also defines a {@code name} this attribute can only contain * a single value. *
- * If this is the only attribute specified consider using the {@code value} alias
+ * If this is the only specified attribute consider using the {@code value} alias
* instead.
* @return the classes to mock
*/
diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java
index 6a681b5974..668167a5a8 100644
--- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java
+++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java
@@ -70,7 +70,7 @@ class MockDefinition extends Definition {
}
/**
- * Return the classes that should be mocked.
+ * Return the class that should be mocked.
* @return the class to mock; never {@code null}
*/
public Class> getClassToMock() {
@@ -79,7 +79,7 @@ class MockDefinition extends Definition {
/**
* Return the extra interfaces.
- * @return the extra interfaces or an empty array
+ * @return the extra interfaces or an empty set
*/
public Set
- * If this is the only attribute specified consider using the {@code value} alias
+ * If this is the only specified attribute consider using the {@code value} alias
* instead.
* @return the classes to mock
*/
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java
index 812eb45eb9..c9a1612623 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java
@@ -38,28 +38,28 @@ public class MockitoContextCustomizerFactoryTests {
public void getContextCustomizerWithoutAnnotationReturnsCustomizer()
throws Exception {
ContextCustomizer customizer = this.factory
- .createContextCustomizer(NoRegisterMocksAnnotation.class, null);
+ .createContextCustomizer(NoMockBeanAnnotation.class, null);
assertThat(customizer).isNotNull();
}
@Test
public void getContextCustomizerWithAnnotationReturnsCustomizer() throws Exception {
ContextCustomizer customizer = this.factory
- .createContextCustomizer(WithRegisterMocksAnnotation.class, null);
+ .createContextCustomizer(WithMockBeanAnnotation.class, null);
assertThat(customizer).isNotNull();
}
@Test
public void getContextCustomizerUsesMocksAsCacheKey() throws Exception {
ContextCustomizer customizer = this.factory
- .createContextCustomizer(WithRegisterMocksAnnotation.class, null);
+ .createContextCustomizer(WithMockBeanAnnotation.class, null);
assertThat(customizer).isNotNull();
ContextCustomizer same = this.factory
- .createContextCustomizer(WithSameRegisterMocksAnnotation.class, null);
+ .createContextCustomizer(WithSameMockBeanAnnotation.class, null);
assertThat(customizer).isNotNull();
ContextCustomizer different = this.factory.createContextCustomizer(
- WithDifferentRegisterMocksAnnotation.class, null);
- assertThat(customizer).isNotNull();
+ WithDifferentMockBeanAnnotation.class, null);
+ assertThat(different).isNotNull();
assertThat(customizer.hashCode()).isEqualTo(same.hashCode());
assertThat(customizer.hashCode()).isNotEqualTo(different.hashCode());
assertThat(customizer).isEqualTo(customizer);
@@ -67,22 +67,22 @@ public class MockitoContextCustomizerFactoryTests {
assertThat(customizer).isNotEqualTo(different);
}
- static class NoRegisterMocksAnnotation {
+ static class NoMockBeanAnnotation {
}
@MockBean({ Service1.class, Service2.class })
- static class WithRegisterMocksAnnotation {
+ static class WithMockBeanAnnotation {
}
@MockBean({ Service2.class, Service1.class })
- static class WithSameRegisterMocksAnnotation {
+ static class WithSameMockBeanAnnotation {
}
@MockBean({ Service1.class })
- static class WithDifferentRegisterMocksAnnotation {
+ static class WithDifferentMockBeanAnnotation {
}
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoInitializeTestExecutionListenerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoInitializeTestExecutionListenerTests.java
index b6cbb5c857..a67d880e13 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoInitializeTestExecutionListenerTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoInitializeTestExecutionListenerTests.java
@@ -62,16 +62,16 @@ public class MockitoInitializeTestExecutionListenerTests {
}
@Test
- public void prepareTestInstanceShouldInitMockitoAnnotation() throws Exception {
- WithMockitoAnnotation instance = new WithMockitoAnnotation();
+ public void prepareTestInstanceShouldInitMockitoAnnotations() throws Exception {
+ WithMockitoAnnotations instance = new WithMockitoAnnotations();
this.listener.prepareTestInstance(mockTestContext(instance));
assertThat(instance.mock).isNotNull();
assertThat(instance.captor).isNotNull();
}
@Test
- public void prepareTestInstanceShouldInjectMockBeans() throws Exception {
- WithMockBeans instance = new WithMockBeans();
+ public void prepareTestInstanceShouldInjectMockBean() throws Exception {
+ WithMockBean instance = new WithMockBean();
this.listener.prepareTestInstance(mockTestContext(instance));
verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance),
(MockDefinition) any());
@@ -87,7 +87,7 @@ public class MockitoInitializeTestExecutionListenerTests {
return testContext;
}
- static class WithMockitoAnnotation {
+ static class WithMockitoAnnotations {
@Mock
InputStream mock;
@@ -97,7 +97,7 @@ public class MockitoInitializeTestExecutionListenerTests {
}
- static class WithMockBeans {
+ static class WithMockBean {
@MockBean
InputStream mockBean;
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java
index 781b61d4a4..0c4e1e0b25 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/ResetMocksTestExecutionListenerTests.java
@@ -41,8 +41,6 @@ import static org.mockito.Mockito.mock;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ResetMocksTestExecutionListenerTests {
- static boolean test001executed;
-
@Autowired
private ApplicationContext context;
@@ -51,7 +49,6 @@ public class ResetMocksTestExecutionListenerTests {
given(getMock("none").greeting()).willReturn("none");
given(getMock("before").greeting()).willReturn("before");
given(getMock("after").greeting()).willReturn("after");
- test001executed = true;
}
@Test
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/ExampleServiceCaller.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/ExampleServiceCaller.java
index 176fa3f5a8..38738a7d16 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/ExampleServiceCaller.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/example/ExampleServiceCaller.java
@@ -16,10 +16,8 @@
package org.springframework.boot.test.mock.mockito.example;
-import java.security.Provider.Service;
-
/**
- * Example bean for mocking tests that calls {@link Service}.
+ * Example bean for mocking tests that calls {@link ExampleService}.
*
* @author Phillip Webb
*/
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java
index 7e4ee7c602..66ed6e53bb 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/web/htmlunit/webdriver/LocalHostWebConnectionHtmlUnitDriverTests.java
@@ -85,7 +85,7 @@ public class LocalHostWebConnectionHtmlUnitDriverTests {
}
@Test
- public void getPageWhenUrlIsRelativeAndNoPortWillUseLocalhost8080() throws Exception {
+ public void getWhenUrlIsRelativeAndNoPortWillUseLocalhost8080() throws Exception {
MockEnvironment environment = new MockEnvironment();
LocalHostWebConnectionHtmlUnitDriver driver = new TestLocalHostWebConnectionHtmlUnitDriver(
environment);