BAEL-1489: Naming test methods correctly

This commit is contained in:
Holger Steinhauer 2018-02-07 21:21:48 +00:00
parent e61b157057
commit 99ef66b2cb

View File

@ -10,7 +10,7 @@ public class Rot13PasswordEncoderTest {
private final Rot13PasswordEncoder encoder = new Rot13PasswordEncoder(); private final Rot13PasswordEncoder encoder = new Rot13PasswordEncoder();
@Test @Test
public void given_theEncodedPassword_should_returnTheClearTextPassword() { public void givenEncodedPassword_whenEncodeIsCalledWithTheEncodedPassword_thenTheClearTextPassword() {
String password = "baeldung"; String password = "baeldung";
String encoded = encoder.encode(password); String encoded = encoder.encode(password);
String actualResult = encoder.encode(encoded); String actualResult = encoder.encode(encoded);
@ -19,7 +19,7 @@ public class Rot13PasswordEncoderTest {
} }
@Test @Test
public void given_correctPassword_should_returnTrue() { public void givenCorrectPassword_whenMatchesIsCalled_thenReturnTrue() {
String password = "baeldung"; String password = "baeldung";
String encoded = encoder.encode(password); String encoded = encoder.encode(password);
boolean actualResult = encoder.matches(password, encoded); boolean actualResult = encoder.matches(password, encoded);
@ -28,7 +28,7 @@ public class Rot13PasswordEncoderTest {
} }
@Test @Test
public void given_incorrectPassword_should_returnFalse() { public void givenIncorrectPassword_whenMatchesIsCalled_thenReturnFalse() {
boolean actualResult = encoder.matches("baeldung", "spring"); boolean actualResult = encoder.matches("baeldung", "spring");
assertThat(actualResult, is(false)); assertThat(actualResult, is(false));