Merge branch '2.7.x' into 3.0.x
Closes gh-38247
This commit is contained in:
@@ -37,6 +37,7 @@ import static org.mockito.BDDMockito.then;
|
||||
* Tests for {@link EncodePasswordCommand}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class EncodePasswordCommandTests {
|
||||
@@ -67,6 +68,17 @@ class EncodePasswordCommandTests {
|
||||
assertThat(status).isEqualTo(ExitStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void encodeWithDefaultShouldUseBcrypt() throws Exception {
|
||||
EncodePasswordCommand command = new EncodePasswordCommand();
|
||||
ExitStatus status = command.run("-a", "default", "boot");
|
||||
then(this.log).should().info(this.message.capture());
|
||||
assertThat(this.message.getValue()).startsWith("{bcrypt}");
|
||||
assertThat(PasswordEncoderFactories.createDelegatingPasswordEncoder().matches("boot", this.message.getValue()))
|
||||
.isTrue();
|
||||
assertThat(status).isEqualTo(ExitStatus.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
void encodeWithBCryptShouldUseBCrypt() throws Exception {
|
||||
EncodePasswordCommand command = new EncodePasswordCommand();
|
||||
|
||||
Reference in New Issue
Block a user