From bc5958c398cfa4b0974238a71e2bf7a9f3081fd7 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 27 Aug 2020 16:45:31 -0700 Subject: [PATCH] Polish test method names Polish method names to remove "should". --- .../boot/origin/OriginTests.java | 12 +++++----- .../boot/origin/TextResourceOriginTests.java | 24 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java index deb4681c91..5489e6ef67 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/OriginTests.java @@ -30,24 +30,24 @@ import static org.mockito.Mockito.mock; class OriginTests { @Test - void fromWhenSourceIsNullShouldReturnNull() { + void fromWhenSourceIsNullReturnsNull() { assertThat(Origin.from(null)).isNull(); } @Test - void fromWhenSourceIsRegularObjectShouldReturnNull() { + void fromWhenSourceIsRegularObjectReturnsNull() { Object source = new Object(); assertThat(Origin.from(source)).isNull(); } @Test - void fromWhenSourceIsOriginShouldReturnSource() { + void fromWhenSourceIsOriginReturnsSource() { Origin origin = mock(Origin.class); assertThat(Origin.from(origin)).isEqualTo(origin); } @Test - void fromWhenSourceIsOriginProviderShouldReturnProvidedOrigin() { + void fromWhenSourceIsOriginProviderReturnsProvidedOrigin() { Origin origin = mock(Origin.class); OriginProvider originProvider = mock(OriginProvider.class); given(originProvider.getOrigin()).willReturn(origin); @@ -55,14 +55,14 @@ class OriginTests { } @Test - void fromWhenSourceIsThrowableShouldUseCause() { + void fromWhenSourceIsThrowableUsesCause() { Origin origin = mock(Origin.class); Exception exception = new RuntimeException(new TestException(origin, null)); assertThat(Origin.from(exception)).isEqualTo(origin); } @Test - void fromWhenSourceIsThrowableAndOriginProviderThatReturnsNullShouldUseCause() { + void fromWhenSourceIsThrowableAndOriginProviderThatReturnsNullUsesCause() { Origin origin = mock(Origin.class); Exception exception = new TestException(null, new TestException(origin, null)); assertThat(Origin.from(exception)).isEqualTo(origin); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java index 7292bd2ae5..550845ac26 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/TextResourceOriginTests.java @@ -31,26 +31,26 @@ import static org.assertj.core.api.Assertions.assertThat; class TextResourceOriginTests { @Test - void createWithNullResourceShouldSetNullResource() { + void createWithNullResourceSetsNullResource() { TextResourceOrigin origin = new TextResourceOrigin(null, null); assertThat(origin.getResource()).isNull(); } @Test - void createWithNullLocationShouldSetNullLocation() { + void createWithNullLocationSetsNullLocation() { TextResourceOrigin origin = new TextResourceOrigin(null, null); assertThat(origin.getLocation()).isNull(); } @Test - void getResourceShouldReturnResource() { + void getResourceReturnResource() { ClassPathResource resource = new ClassPathResource("foo.txt"); TextResourceOrigin origin = new TextResourceOrigin(resource, null); assertThat(origin.getResource()).isEqualTo(resource); } @Test - void getLocationShouldReturnLocation() { + void getLocationReturnsLocation() { Location location = new Location(1, 2); TextResourceOrigin origin = new TextResourceOrigin(null, location); assertThat(origin.getLocation()).isEqualTo(location); @@ -58,25 +58,25 @@ class TextResourceOriginTests { } @Test - void getLocationLineShouldReturnLine() { + void getLocationLineReturnsLine() { Location location = new Location(1, 2); assertThat(location.getLine()).isEqualTo(1); } @Test - void getLocationColumnShouldReturnColumn() { + void getLocationColumnReturnsColumn() { Location location = new Location(1, 2); assertThat(location.getColumn()).isEqualTo(2); } @Test - void locationToStringShouldReturnNiceString() { + void locationToStringReturnsNiceString() { Location location = new Location(1, 2); assertThat(location.toString()).isEqualTo("2:3"); } @Test - void toStringShouldReturnNiceString() { + void toStringReturnsNiceString() { ClassPathResource resource = new ClassPathResource("foo.txt"); Location location = new Location(1, 2); TextResourceOrigin origin = new TextResourceOrigin(resource, location); @@ -84,21 +84,21 @@ class TextResourceOriginTests { } @Test - void toStringWhenResourceIsNullShouldReturnNiceString() { + void toStringWhenResourceIsNullReturnsNiceString() { Location location = new Location(1, 2); TextResourceOrigin origin = new TextResourceOrigin(null, location); assertThat(origin.toString()).isEqualTo("unknown resource [?]:2:3"); } @Test - void toStringWhenLocationIsNullShouldReturnNiceString() { + void toStringWhenLocationIsNullReturnsNiceString() { ClassPathResource resource = new ClassPathResource("foo.txt"); TextResourceOrigin origin = new TextResourceOrigin(resource, null); assertThat(origin.toString()).isEqualTo("class path resource [foo.txt]"); } @Test - void locationEqualsAndHashCodeShouldUseLineAndColumn() { + void locationEqualsAndHashCodeUsesLineAndColumn() { Location location1 = new Location(1, 2); Location location2 = new Location(1, 2); Location location3 = new Location(2, 2); @@ -111,7 +111,7 @@ class TextResourceOriginTests { } @Test - void equalsAndHashCodeShouldResourceAndLocation() { + void equalsAndHashCodeUsesResourceAndLocation() { TextResourceOrigin origin1 = new TextResourceOrigin(new ClassPathResource("foo.txt"), new Location(1, 2)); TextResourceOrigin origin2 = new TextResourceOrigin(new ClassPathResource("foo.txt"), new Location(1, 2)); TextResourceOrigin origin3 = new TextResourceOrigin(new ClassPathResource("foo.txt"), new Location(2, 2));