parent
d3d6a8743e
commit
742df2cd1d
|
@ -28,6 +28,7 @@ import java.util.Map;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -215,8 +216,17 @@ public class DelegatingPasswordEncoderTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void upgradeEncodingWhenSameIdThenEncoderDecides() {
|
||||
this.passwordEncoder.upgradeEncoding(this.bcryptEncodedPassword);
|
||||
public void upgradeEncodingWhenSameIdAndEncoderFalseThenEncoderDecidesFalse() {
|
||||
assertThat(this.passwordEncoder.upgradeEncoding(this.bcryptEncodedPassword)).isFalse();
|
||||
|
||||
verify(bcrypt).upgradeEncoding(this.encodedPassword);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void upgradeEncodingWhenSameIdAndEncoderTrueThenEncoderDecidesTrue() {
|
||||
when(this.bcrypt.upgradeEncoding(any())).thenReturn(true);
|
||||
|
||||
assertThat(this.passwordEncoder.upgradeEncoding(this.bcryptEncodedPassword)).isTrue();
|
||||
|
||||
verify(bcrypt).upgradeEncoding(this.encodedPassword);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue