From 5759f685e572aac8ec4da2a3bb8760c4156542b5 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sat, 14 May 2016 13:20:19 +0900 Subject: [PATCH] Fix Mockito tests to align with name and comments Fixup Mockto tests where the test implementation didn't align with the name of the test or the test Javadoc. Closes gh-5972 --- .../mockito/MockBeanOnTestFieldForExistingBeanConfig.java | 3 ++- .../MockBeanOnTestFieldForNewBeanIntegrationTests.java | 3 +-- ...yBeanOnTestFieldForExistingBeanCacheIntegrationTests.java | 4 ++-- .../mockito/SpyBeanOnTestFieldForExistingBeanConfig.java | 3 ++- .../SpyBeanOnTestFieldForExistingBeanIntegrationTests.java | 4 ++-- .../SpyBeanOnTestFieldForNewBeanIntegrationTests.java | 5 ++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanConfig.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanConfig.java index e1447d45645..c70cc39d7f4 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanConfig.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanConfig.java @@ -17,6 +17,7 @@ package org.springframework.boot.test.mock.mockito; import org.springframework.boot.test.mock.mockito.example.ExampleServiceCaller; +import org.springframework.boot.test.mock.mockito.example.FailingExampleService; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -28,7 +29,7 @@ import org.springframework.context.annotation.Import; * @author Phillip Webb */ @Configuration -@Import(ExampleServiceCaller.class) +@Import({ ExampleServiceCaller.class, FailingExampleService.class }) public class MockBeanOnTestFieldForExistingBeanConfig { } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java index 5e39d6ef959..d0459a8ef4a 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForNewBeanIntegrationTests.java @@ -22,7 +22,6 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.example.ExampleService; import org.springframework.boot.test.mock.mockito.example.ExampleServiceCaller; -import org.springframework.boot.test.mock.mockito.example.FailingExampleService; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.test.context.junit4.SpringRunner; @@ -51,7 +50,7 @@ public class MockBeanOnTestFieldForNewBeanIntegrationTests { } @Configuration - @Import({ ExampleServiceCaller.class, FailingExampleService.class }) + @Import(ExampleServiceCaller.class) static class Config { } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java index b955605584f..fdfd02a5c8e 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.example.ExampleService; import org.springframework.boot.test.mock.mockito.example.ExampleServiceCaller; -import org.springframework.boot.test.mock.mockito.example.SimpleExampleService; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @@ -42,7 +42,7 @@ import static org.mockito.Mockito.verify; public class SpyBeanOnTestFieldForExistingBeanCacheIntegrationTests { @SpyBean - private SimpleExampleService exampleService; + private ExampleService exampleService; @Autowired private ExampleServiceCaller caller; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanConfig.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanConfig.java index 016a3a4dac6..00f9e6cb0c0 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanConfig.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanConfig.java @@ -17,6 +17,7 @@ package org.springframework.boot.test.mock.mockito; import org.springframework.boot.test.mock.mockito.example.ExampleServiceCaller; +import org.springframework.boot.test.mock.mockito.example.SimpleExampleService; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -28,7 +29,7 @@ import org.springframework.context.annotation.Import; * @author Phillip Webb */ @Configuration -@Import(ExampleServiceCaller.class) +@Import({ ExampleServiceCaller.class, SimpleExampleService.class }) public class SpyBeanOnTestFieldForExistingBeanConfig { } diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java index 08ce1e880aa..d1e268a747e 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanIntegrationTests.java @@ -20,8 +20,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.example.ExampleService; import org.springframework.boot.test.mock.mockito.example.ExampleServiceCaller; -import org.springframework.boot.test.mock.mockito.example.SimpleExampleService; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @@ -39,7 +39,7 @@ import static org.mockito.Mockito.verify; public class SpyBeanOnTestFieldForExistingBeanIntegrationTests { @SpyBean - private SimpleExampleService exampleService; + private ExampleService exampleService; @Autowired private ExampleServiceCaller caller; diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java index 7161324288c..b33922ba3df 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForNewBeanIntegrationTests.java @@ -20,7 +20,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.example.ExampleService; import org.springframework.boot.test.mock.mockito.example.ExampleServiceCaller; import org.springframework.boot.test.mock.mockito.example.SimpleExampleService; import org.springframework.context.annotation.Configuration; @@ -39,7 +38,7 @@ import static org.mockito.Mockito.verify; public class SpyBeanOnTestFieldForNewBeanIntegrationTests { @SpyBean - private ExampleService exampleService; + private SimpleExampleService exampleService; @Autowired private ExampleServiceCaller caller; @@ -51,7 +50,7 @@ public class SpyBeanOnTestFieldForNewBeanIntegrationTests { } @Configuration - @Import({ ExampleServiceCaller.class, SimpleExampleService.class }) + @Import(ExampleServiceCaller.class) static class Config { }