From 04448d6bd92a889eb7f403aa4ac6b30ba25207b2 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 16 Sep 2016 18:33:06 -0700 Subject: [PATCH] Polish --- .../boot/test/mock/mockito/Definition.java | 3 ++- .../boot/test/mock/mockito/DefinitionsParser.java | 5 ++--- .../springframework/boot/test/mock/mockito/MockBean.java | 3 +-- .../boot/test/mock/mockito/MockDefinition.java | 5 +++-- .../springframework/boot/test/mock/mockito/SpyBean.java | 3 +-- .../boot/test/mock/mockito/DefinitionsParserTests.java | 6 ++---- ...FieldForExistingBeanWithQualifierIntegrationTests.java | 8 ++++---- .../boot/test/mock/mockito/MockDefinitionTests.java | 6 ++---- .../test/mock/mockito/MockitoContextCustomizerTests.java | 3 ++- .../boot/test/mock/mockito/SpyDefinitionTests.java | 3 ++- 10 files changed, 21 insertions(+), 24 deletions(-) diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java index fff5f0b7f8..f8a0b175e3 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java @@ -38,7 +38,8 @@ abstract class Definition { private final boolean proxyTargetAware; - Definition(AnnotatedElement element, String name, MockReset reset, boolean proxyTargetAware) { + Definition(AnnotatedElement element, String name, MockReset reset, + boolean proxyTargetAware) { this.element = element; this.name = name; this.reset = (reset != null ? reset : MockReset.AFTER); diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java index 1b16fa2d1e..faeddf0d82 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java @@ -92,7 +92,7 @@ class DefinitionsParser { } for (ResolvableType typeToMock : typesToMock) { MockDefinition definition = new MockDefinition(element, annotation.name(), - typeToMock, annotation.extraInterfaces(), annotation.answer(), + typeToMock, annotation.extraInterfaces(), annotation.answer(), annotation.serializable(), annotation.reset()); addDefinition(definition, "mock"); } @@ -113,8 +113,7 @@ class DefinitionsParser { } } - private void addDefinition(Definition definition, - String type) { + private void addDefinition(Definition definition, String type) { boolean isNewDefinition = this.definitions.add(definition); Assert.state(isNewDefinition, "Duplicate " + type + " definition " + definition); AnnotatedElement element = definition.getElement(); 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 76ae4c0bd2..d82a419d46 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 @@ -66,8 +66,7 @@ import org.springframework.test.context.junit4.SpringRunner; * * * } - * - * If there is more than one bean of the requested type, qualifier metadata must be + * If there is more than one bean of the requested type, qualifier metadata must be * specified at field level:
  * @RunWith(SpringRunner.class)
  * public class ExampleTests {
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 ae52ee62de..2284741b58 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
@@ -50,8 +50,9 @@ class MockDefinition extends Definition {
 
 	private final boolean serializable;
 
-	MockDefinition(AnnotatedElement element, String name, ResolvableType typeToMock, Class[] extraInterfaces,
-			Answers answer, boolean serializable, MockReset reset) {
+	MockDefinition(AnnotatedElement element, String name, ResolvableType typeToMock,
+			Class[] extraInterfaces, Answers answer, boolean serializable,
+			MockReset reset) {
 		super(element, name, reset, false);
 		Assert.notNull(typeToMock, "TypeToMock must not be null");
 		this.typeToMock = typeToMock;
diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyBean.java b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyBean.java
index 980f37e4ef..1b7cc5fa6c 100644
--- a/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyBean.java
+++ b/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyBean.java
@@ -66,8 +66,7 @@ import org.springframework.test.context.junit4.SpringRunner;
  *
  *
  * }
- * 
- * If there is more than one bean of the requested type, qualifier metadata must be + * If there is more than one bean of the requested type, qualifier metadata must be * specified at field level:
  * @RunWith(SpringRunner.class)
  * public class ExampleTests {
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java
index bcd7b49176..6b590e995c 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java
@@ -82,8 +82,7 @@ public class DefinitionsParserTests {
 		this.parser.parse(MockBeanOnClassAndField.class);
 		assertThat(getDefinitions()).hasSize(2);
 		MockDefinition classDefinition = getMockDefinition(0);
-		assertThat(classDefinition.getElement())
-				.isEqualTo(MockBeanOnClassAndField.class);
+		assertThat(classDefinition.getElement()).isEqualTo(MockBeanOnClassAndField.class);
 		assertThat(classDefinition.getTypeToMock().resolve())
 				.isEqualTo(ExampleService.class);
 		MockDefinition fieldDefinition = getMockDefinition(1);
@@ -161,8 +160,7 @@ public class DefinitionsParserTests {
 		this.parser.parse(SpyBeanOnClassAndField.class);
 		assertThat(getDefinitions()).hasSize(2);
 		SpyDefinition classDefinition = getSpyDefinition(0);
-		assertThat(classDefinition.getElement())
-				.isEqualTo(SpyBeanOnClassAndField.class);
+		assertThat(classDefinition.getElement()).isEqualTo(SpyBeanOnClassAndField.class);
 		assertThat(classDefinition.getTypeToSpy().resolve())
 				.isEqualTo(RealExampleService.class);
 		SpyDefinition fieldDefinition = getSpyDefinition(1);
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java
index a87f89d9be..a834a32bc2 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java
@@ -34,8 +34,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.verify;
 
 /**
- * Test {@link MockBean} on a test class field can be used to replace existing bean
- * while preserving qualifiers.
+ * Test {@link MockBean} on a test class field can be used to replace existing bean while
+ * preserving qualifiers.
  */
 @RunWith(SpringRunner.class)
 public class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
@@ -59,8 +59,8 @@ public class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
 	@Test
 	public void onlyQualifiedBeanIsReplaced() {
 		assertThat(this.applicationContext.getBean("service")).isSameAs(this.service);
-		ExampleService anotherService = this.applicationContext.getBean(
-				"anotherService", ExampleService.class);
+		ExampleService anotherService = this.applicationContext.getBean("anotherService",
+				ExampleService.class);
 		assertThat(anotherService.greeting()).isEqualTo("Another");
 	}
 
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java
index e818178e59..11cc007e49 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java
@@ -65,8 +65,7 @@ public class MockDefinitionTests {
 	@Test
 	public void createExplicit() throws Exception {
 		MockDefinition definition = new MockDefinition(getClass(), "name",
-				EXAMPLE_SERVICE_TYPE,
-				new Class[] { ExampleExtraInterface.class },
+				EXAMPLE_SERVICE_TYPE, new Class[] { ExampleExtraInterface.class },
 				Answers.RETURNS_SMART_NULLS, true, MockReset.BEFORE);
 		assertThat(definition.getElement()).isEqualTo(getClass());
 		assertThat(definition.getName()).isEqualTo("name");
@@ -81,8 +80,7 @@ public class MockDefinitionTests {
 
 	@Test
 	public void createMock() throws Exception {
-		MockDefinition definition = new MockDefinition(null, "name",
-				EXAMPLE_SERVICE_TYPE,
+		MockDefinition definition = new MockDefinition(null, "name", EXAMPLE_SERVICE_TYPE,
 				new Class[] { ExampleExtraInterface.class },
 				Answers.RETURNS_SMART_NULLS, true, MockReset.BEFORE);
 		ExampleService mock = definition.createMock();
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java
index f8e1a8c1ce..ffc90ee871 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java
@@ -53,7 +53,8 @@ public class MockitoContextCustomizerTests {
 	}
 
 	private MockDefinition createTestMockDefinition(Class typeToMock) {
-		return new MockDefinition(null, null, ResolvableType.forClass(typeToMock), null, null, false, null);
+		return new MockDefinition(null, null, ResolvableType.forClass(typeToMock), null,
+				null, false, null);
 	}
 
 }
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java
index 91399c7adb..de53937694 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java
@@ -52,7 +52,8 @@ public class SpyDefinitionTests {
 
 	@Test
 	public void createWithDefaults() throws Exception {
-		SpyDefinition definition = new SpyDefinition(null, null, REAL_SERVICE_TYPE, null, true);
+		SpyDefinition definition = new SpyDefinition(null, null, REAL_SERVICE_TYPE, null,
+				true);
 		assertThat(definition.getElement()).isNull();
 		assertThat(definition.getName()).isNull();
 		assertThat(definition.getTypeToSpy()).isEqualTo(REAL_SERVICE_TYPE);