Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Sep 27, 2024
1 parent 9c74690 commit ea8b8ae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
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.
Expand All @@ -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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ void contextCustomizerCannotBeCreatedWithTooManyCandidates() {
.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"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ void contextCustomizerCannotBeCreatedWithNoSuchBeanType() {
.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
Expand All @@ -67,8 +67,8 @@ void contextCustomizerCannotBeCreatedWithTooManyBeansOfThatType() {
.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"));
}


Expand Down

0 comments on commit ea8b8ae

Please sign in to comment.