Merge branch '3.0.x' into 3.1.x

Closes gh-38248
This commit is contained in:
Moritz Halbritter
2023-11-07 11:25:24 +01:00
2 changed files with 21 additions and 4 deletions

View File

@@ -36,6 +36,7 @@ import static org.mockito.BDDMockito.then;
* Tests for {@link EncodePasswordCommand}.
*
* @author Phillip Webb
* @author Moritz Halbritter
*/
@ExtendWith(MockitoExtension.class)
class EncodePasswordCommandTests {
@@ -63,6 +64,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(assertArg((message) -> {
assertThat(message).startsWith("{bcrypt}");
assertThat(PasswordEncoderFactories.createDelegatingPasswordEncoder().matches("boot", message)).isTrue();
}));
assertThat(status).isEqualTo(ExitStatus.OK);
}
@Test
void encodeWithBCryptShouldUseBCrypt() throws Exception {
EncodePasswordCommand command = new EncodePasswordCommand();