@Override
    public Mono<UserDetails> updatePassword(UserDetails user, String newPassword) {
        return userService.updatePassword(user.getUsername(), newPassword)
            .map(u -> withNewPassword(user, newPassword));
    }
@Test
    void shouldReturnErrorWhenFailedToUpdatePassword() {
        var fakeUser = createFakeUserDetails();

        var exception = new RuntimeException("failed to update password");
        when(userService.updatePassword("faker", "new-fake-password")).thenReturn(
            Mono.error(exception)
        );

        var userDetailsMono = userDetailService.updatePassword(fakeUser, "new-fake-password");

        StepVerifier.create(userDetailsMono)
            .expectSubscription()
            .expectErrorMatches(throwable -> throwable == exception)
            .verify();
        verify(userService, times(1)).updatePassword(eq("faker"), eq("new-fake-password"));
    }