Polish PasswordEncoderUtilsTests

* Add more tests
* Smaller tests
* Follow new naming convention
This commit is contained in:
Rob Winch 2016-10-24 11:24:05 -05:00
parent f432c04111
commit dc9f9b140f
1 changed files with 19 additions and 4 deletions

View File

@ -25,25 +25,40 @@ import org.junit.Test;
public class PasswordEncoderUtilsTests {
@Test
public void differentLength() {
public void equalsWhenDifferentLengthThenFalse() {
assertThat(PasswordEncoderUtils.equals("abc", "a")).isFalse();
assertThat(PasswordEncoderUtils.equals("a", "abc")).isFalse();
}
@Test
public void equalsNull() {
public void equalsWhenNullAndNotEmtpyThenFalse() {
assertThat(PasswordEncoderUtils.equals(null, "a")).isFalse();
assertThat(PasswordEncoderUtils.equals("a", null)).isFalse();
}
@Test
public void equalsWhenNullAndNullThenTrue() {
assertThat(PasswordEncoderUtils.equals(null, null)).isTrue();
}
@Test
public void equalsCaseSensitive() {
public void equalsWhenNullAndEmptyThenFalse() {
assertThat(PasswordEncoderUtils.equals(null, "")).isFalse();
assertThat(PasswordEncoderUtils.equals("", null)).isFalse();
}
@Test
public void equalsWhenEmtpyAndEmptyThenTrue() {
assertThat(PasswordEncoderUtils.equals("", "")).isTrue();
}
@Test
public void equalsWhenDifferentCaseThenFalse() {
assertThat(PasswordEncoderUtils.equals("aBc", "abc")).isFalse();
}
@Test
public void equalsSuccess() {
public void equalsWhenSameThenTrue() {
assertThat(PasswordEncoderUtils.equals("abcdef", "abcdef")).isTrue();
}
}