Skip to content

Commit 9b4be82

Browse files
daiaziusbrianchandotcom
authored andcommitted
LPD-43475 Set an algorithm to prevent changes in environment from interfering with the test results
1 parent c8041d0 commit 9b4be82

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

modules/apps/user/user-test/src/testIntegration/java/com/liferay/user/service/test/UserLocalServiceTest.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -814,14 +814,21 @@ public void testOutdatedPasswordAlgorithmIsUpdatedAfterLogin()
814814

815815
String password = "password";
816816

817-
user = _userLocalService.updatePassword(
818-
user.getUserId(), password, password, false, true);
817+
try (AutoCloseable autoCloseable =
818+
ReflectionTestUtil.setFieldValueWithAutoCloseable(
819+
PasswordEncryptorUtil.class,
820+
"_PASSWORDS_ENCRYPTION_ALGORITHM",
821+
"PBKDF2WITHHMACSHA1/160/1300000")) {
819822

820-
Assert.assertTrue(
821-
user.getPassword(
822-
).startsWith(
823-
"{PBKDF2WITHHMACSHA1}"
824-
));
823+
user = _userLocalService.updatePassword(
824+
user.getUserId(), password, password, false, true);
825+
826+
Assert.assertTrue(
827+
user.getPassword(
828+
).startsWith(
829+
"{PBKDF2WITHHMACSHA1}"
830+
));
831+
}
825832

826833
try (AutoCloseable autoCloseable1 =
827834
ReflectionTestUtil.setFieldValueWithAutoCloseable(

0 commit comments

Comments
 (0)