Polish test method names

Polish method names to remove "should".
pull/23127/head
Phillip Webb 4 years ago
parent c613d119f7
commit bc5958c398

@ -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);

@ -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));

Loading…
Cancel
Save