From 8919c7317b26854dd742be5ebd345badaed0bcb2 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Sat, 1 Jun 2019 18:09:33 +0200 Subject: [PATCH] Polish "Cleanup tests by using more idiomatic assertj assertions" See gh-418 --- .../samples/petclinic/owner/PetTypeFormatterTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java b/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java index cf5f6cfb24d..9ba43148019 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java @@ -29,7 +29,7 @@ import org.mockito.junit.MockitoJUnitRunner; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; +import static org.mockito.BDDMockito.given; /** * Test class for {@link PetTypeFormatter} @@ -59,14 +59,14 @@ public void testPrint() { @Test public void shouldParse() throws ParseException { - when(this.pets.findPetTypes()).thenReturn(makePetTypes()); + given(this.pets.findPetTypes()).willReturn(makePetTypes()); PetType petType = petTypeFormatter.parse("Bird", Locale.ENGLISH); assertThat(petType.getName()).isEqualTo("Bird"); } @Test(expected = ParseException.class) public void shouldThrowParseException() throws ParseException { - when(this.pets.findPetTypes()).thenReturn(makePetTypes()); + given(this.pets.findPetTypes()).willReturn(makePetTypes()); petTypeFormatter.parse("Fish", Locale.ENGLISH); }