Polishing
This commit is contained in:
@@ -19,11 +19,14 @@ package org.springframework.test.context.bean.override.mockito;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.quality.Strictness;
|
||||
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.BDDMockito.when;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Integration tests for explicitly-defined {@link MockitoBeanSettings} with
|
||||
* lenient stubbing.
|
||||
@@ -38,8 +41,8 @@ class MockitoBeanSettingsLenientIntegrationTests {
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
void unusedStubbingNotReported() {
|
||||
List list = Mockito.mock(List.class);
|
||||
Mockito.when(list.get(Mockito.anyInt())).thenReturn(new Object());
|
||||
List list = mock();
|
||||
when(list.get(anyInt())).thenReturn(new Object());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ class MockitoMockBeanTests {
|
||||
.isThrownBy(context::refresh)
|
||||
.withMessage("""
|
||||
Unable to select a bean definition to override: found 2 bean definitions \
|
||||
of type %s (as required by annotated field '%s.example'): %s""".formatted(
|
||||
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2")));
|
||||
of type %s (as required by annotated field '%s.example'): %s""",
|
||||
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ class MockitoSpyBeanTests {
|
||||
.isThrownBy(context::refresh)
|
||||
.withMessage("""
|
||||
Unable to select a bean to override by wrapping: found 0 bean instances of \
|
||||
type %s (as required by annotated field '%s.example')""".formatted(
|
||||
String.class.getName(), ByTypeSingleLookup.class.getSimpleName()));
|
||||
type %s (as required by annotated field '%s.example')""",
|
||||
String.class.getName(), ByTypeSingleLookup.class.getSimpleName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -67,8 +67,8 @@ class MockitoSpyBeanTests {
|
||||
.isThrownBy(context::refresh)
|
||||
.withMessage("""
|
||||
Unable to select a bean to override by wrapping: found 2 bean instances \
|
||||
of type %s (as required by annotated field '%s.example'): %s""".formatted(
|
||||
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2")));
|
||||
of type %s (as required by annotated field '%s.example'): %s""",
|
||||
String.class.getName(), ByTypeSingleLookup.class.getSimpleName(), List.of("bean1", "bean2"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user