Skip to content

Commit ea8b8ae

Browse files
committed
Polishing
1 parent 9c74690 commit ea8b8ae

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/MockitoBeanSettingsLenientIntegrationTests.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
import java.util.List;
2020

2121
import org.junit.jupiter.api.Test;
22-
import org.mockito.Mockito;
2322
import org.mockito.quality.Strictness;
2423

2524
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
2625

26+
import static org.mockito.ArgumentMatchers.anyInt;
27+
import static org.mockito.BDDMockito.when;
28+
import static org.mockito.Mockito.mock;
29+
2730
/**
2831
* Integration tests for explicitly-defined {@link MockitoBeanSettings} with
2932
* lenient stubbing.
@@ -38,8 +41,8 @@ class MockitoBeanSettingsLenientIntegrationTests {
3841
@Test
3942
@SuppressWarnings("rawtypes")
4043
void unusedStubbingNotReported() {
41-
List list = Mockito.mock(List.class);
42-
Mockito.when(list.get(Mockito.anyInt())).thenReturn(new Object());
44+
List list = mock();
45+
when(list.get(anyInt())).thenReturn(new Object());
4346
}
4447

4548
}

spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/MockitoMockBeanTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ void contextCustomizerCannotBeCreatedWithTooManyCandidates() {
4242
.isThrownBy(context::refresh)
4343
.withMessage("""
4444
Unable to select a bean definition to override: found 2 bean definitions \
45-
of type %s (as required by annotated field '%s.example'): %s""".formatted(
46-
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2")));
45+
of type %s (as required by annotated field '%s.example'): %s""",
46+
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2"));
4747
}
4848

4949

spring-test/src/test/java/org/springframework/test/context/bean/override/mockito/MockitoSpyBeanTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ void contextCustomizerCannotBeCreatedWithNoSuchBeanType() {
5353
.isThrownBy(context::refresh)
5454
.withMessage("""
5555
Unable to select a bean to override by wrapping: found 0 bean instances of \
56-
type %s (as required by annotated field '%s.example')""".formatted(
57-
String.class.getName(), ByTypeSingleLookup.class.getSimpleName()));
56+
type %s (as required by annotated field '%s.example')""",
57+
String.class.getName(), ByTypeSingleLookup.class.getSimpleName());
5858
}
5959

6060
@Test
@@ -67,8 +67,8 @@ void contextCustomizerCannotBeCreatedWithTooManyBeansOfThatType() {
6767
.isThrownBy(context::refresh)
6868
.withMessage("""
6969
Unable to select a bean to override by wrapping: found 2 bean instances \
70-
of type %s (as required by annotated field '%s.example'): %s""".formatted(
71-
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2")));
70+
of type %s (as required by annotated field '%s.example'): %s""",
71+
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2"));
7272
}
7373

7474

0 commit comments

Comments
 (0)