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