Skip to content

Commit 04448d6

Browse files
committed
Polish
1 parent 6ec1ac0 commit 04448d6

File tree

10 files changed

+21
-24
lines changed

10 files changed

+21
-24
lines changed

spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ abstract class Definition {
3838

3939
private final boolean proxyTargetAware;
4040

41-
Definition(AnnotatedElement element, String name, MockReset reset, boolean proxyTargetAware) {
41+
Definition(AnnotatedElement element, String name, MockReset reset,
42+
boolean proxyTargetAware) {
4243
this.element = element;
4344
this.name = name;
4445
this.reset = (reset != null ? reset : MockReset.AFTER);

spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private void parseMockBeanAnnotation(MockBean annotation, AnnotatedElement eleme
9292
}
9393
for (ResolvableType typeToMock : typesToMock) {
9494
MockDefinition definition = new MockDefinition(element, annotation.name(),
95-
typeToMock, annotation.extraInterfaces(), annotation.answer(),
95+
typeToMock, annotation.extraInterfaces(), annotation.answer(),
9696
annotation.serializable(), annotation.reset());
9797
addDefinition(definition, "mock");
9898
}
@@ -113,8 +113,7 @@ private void parseSpyBeanAnnotation(SpyBean annotation, AnnotatedElement element
113113
}
114114
}
115115

116-
private void addDefinition(Definition definition,
117-
String type) {
116+
private void addDefinition(Definition definition, String type) {
118117
boolean isNewDefinition = this.definitions.add(definition);
119118
Assert.state(isNewDefinition, "Duplicate " + type + " definition " + definition);
120119
AnnotatedElement element = definition.getElement();

spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@
6666
*
6767
*
6868
* }
69-
* </pre>
70-
* If there is more than one bean of the requested type, qualifier metadata must be
69+
* </pre> If there is more than one bean of the requested type, qualifier metadata must be
7170
* specified at field level: <pre class="code">
7271
* &#064;RunWith(SpringRunner.class)
7372
* public class ExampleTests {

spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ class MockDefinition extends Definition {
5050

5151
private final boolean serializable;
5252

53-
MockDefinition(AnnotatedElement element, String name, ResolvableType typeToMock, Class<?>[] extraInterfaces,
54-
Answers answer, boolean serializable, MockReset reset) {
53+
MockDefinition(AnnotatedElement element, String name, ResolvableType typeToMock,
54+
Class<?>[] extraInterfaces, Answers answer, boolean serializable,
55+
MockReset reset) {
5556
super(element, name, reset, false);
5657
Assert.notNull(typeToMock, "TypeToMock must not be null");
5758
this.typeToMock = typeToMock;

spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyBean.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@
6666
*
6767
*
6868
* }
69-
* </pre>
70-
* If there is more than one bean of the requested type, qualifier metadata must be
69+
* </pre> If there is more than one bean of the requested type, qualifier metadata must be
7170
* specified at field level: <pre class="code">
7271
* &#064;RunWith(SpringRunner.class)
7372
* public class ExampleTests {

spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/DefinitionsParserTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public void parseMockBeanOnClassAndField() throws Exception {
8282
this.parser.parse(MockBeanOnClassAndField.class);
8383
assertThat(getDefinitions()).hasSize(2);
8484
MockDefinition classDefinition = getMockDefinition(0);
85-
assertThat(classDefinition.getElement())
86-
.isEqualTo(MockBeanOnClassAndField.class);
85+
assertThat(classDefinition.getElement()).isEqualTo(MockBeanOnClassAndField.class);
8786
assertThat(classDefinition.getTypeToMock().resolve())
8887
.isEqualTo(ExampleService.class);
8988
MockDefinition fieldDefinition = getMockDefinition(1);
@@ -161,8 +160,7 @@ public void parseSpyBeanOnClassAndField() throws Exception {
161160
this.parser.parse(SpyBeanOnClassAndField.class);
162161
assertThat(getDefinitions()).hasSize(2);
163162
SpyDefinition classDefinition = getSpyDefinition(0);
164-
assertThat(classDefinition.getElement())
165-
.isEqualTo(SpyBeanOnClassAndField.class);
163+
assertThat(classDefinition.getElement()).isEqualTo(SpyBeanOnClassAndField.class);
166164
assertThat(classDefinition.getTypeToSpy().resolve())
167165
.isEqualTo(RealExampleService.class);
168166
SpyDefinition fieldDefinition = getSpyDefinition(1);

spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
import static org.mockito.Mockito.verify;
3535

3636
/**
37-
* Test {@link MockBean} on a test class field can be used to replace existing bean
38-
* while preserving qualifiers.
37+
* Test {@link MockBean} on a test class field can be used to replace existing bean while
38+
* preserving qualifiers.
3939
*/
4040
@RunWith(SpringRunner.class)
4141
public class MockBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
@@ -59,8 +59,8 @@ public void testMocking() throws Exception {
5959
@Test
6060
public void onlyQualifiedBeanIsReplaced() {
6161
assertThat(this.applicationContext.getBean("service")).isSameAs(this.service);
62-
ExampleService anotherService = this.applicationContext.getBean(
63-
"anotherService", ExampleService.class);
62+
ExampleService anotherService = this.applicationContext.getBean("anotherService",
63+
ExampleService.class);
6464
assertThat(anotherService.greeting()).isEqualTo("Another");
6565
}
6666

spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockDefinitionTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public void createWithDefaults() throws Exception {
6565
@Test
6666
public void createExplicit() throws Exception {
6767
MockDefinition definition = new MockDefinition(getClass(), "name",
68-
EXAMPLE_SERVICE_TYPE,
69-
new Class<?>[] { ExampleExtraInterface.class },
68+
EXAMPLE_SERVICE_TYPE, new Class<?>[] { ExampleExtraInterface.class },
7069
Answers.RETURNS_SMART_NULLS, true, MockReset.BEFORE);
7170
assertThat(definition.getElement()).isEqualTo(getClass());
7271
assertThat(definition.getName()).isEqualTo("name");
@@ -81,8 +80,7 @@ public void createExplicit() throws Exception {
8180

8281
@Test
8382
public void createMock() throws Exception {
84-
MockDefinition definition = new MockDefinition(null, "name",
85-
EXAMPLE_SERVICE_TYPE,
83+
MockDefinition definition = new MockDefinition(null, "name", EXAMPLE_SERVICE_TYPE,
8684
new Class<?>[] { ExampleExtraInterface.class },
8785
Answers.RETURNS_SMART_NULLS, true, MockReset.BEFORE);
8886
ExampleService mock = definition.createMock();

spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public void hashCodeAndEquals() {
5353
}
5454

5555
private MockDefinition createTestMockDefinition(Class<?> typeToMock) {
56-
return new MockDefinition(null, null, ResolvableType.forClass(typeToMock), null, null, false, null);
56+
return new MockDefinition(null, null, ResolvableType.forClass(typeToMock), null,
57+
null, false, null);
5758
}
5859

5960
}

spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyDefinitionTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public void classToSpyMustNotBeNull() throws Exception {
5252

5353
@Test
5454
public void createWithDefaults() throws Exception {
55-
SpyDefinition definition = new SpyDefinition(null, null, REAL_SERVICE_TYPE, null, true);
55+
SpyDefinition definition = new SpyDefinition(null, null, REAL_SERVICE_TYPE, null,
56+
true);
5657
assertThat(definition.getElement()).isNull();
5758
assertThat(definition.getName()).isNull();
5859
assertThat(definition.getTypeToSpy()).isEqualTo(REAL_SERVICE_TYPE);

0 commit comments

Comments
 (0)