@@ -0,0 +1,1564 @@
+package org.datacite.mds.service.impl;%0A%0Aimport static org.junit.Assert.*;%0A%0Aimport java.lang.reflect.Field;%0A%0Aimport org.apache.commons.codec.digest.DigestUtils;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0A%0Apublic class PasswordEncoderImplTest %7B%0A%0A    PasswordEncoderImpl passwordEncoder;%0A    final static String SALT = %22dummysalt%22;%0A    final static String RAW_PASS = %22test_pass%22;%0A%0A    @Before%0A    public void init() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException %7B%0A        passwordEncoder = new PasswordEncoderImpl();%0A        Field saltField = PasswordEncoderImpl.class.getDeclaredField(%22salt%22);%0A        saltField.setAccessible(true);%0A        saltField.set(passwordEncoder, SALT);%0A    %7D%0A    %0A    @Test %0A    public void encodePassword_algorithm() %7B%0A        String encPass = DigestUtils.sha256Hex(RAW_PASS + %22%7B%22 + SALT + %22%7D%22);%0A        assertEquals(encPass, passwordEncoder.encodePassword(RAW_PASS, null));%0A    %7D%0A    %0A    @Test%0A    public void encodePassword_globalSalt() %7B%0A        String encPass1 = passwordEncoder.encodePassword(RAW_PASS, %22salt%22);%0A        String encPass2 = passwordEncoder.encodePassword(RAW_PASS, %22another salt%22);%0A        assertEquals(encPass1, encPass2);%0A    %7D%0A    %0A    @Test%0A    public void isPasswordValid() %7B%0A        String encPass = passwordEncoder.encodePassword(RAW_PASS, %22salt%22);%0A        assertTrue(passwordEncoder.isPasswordValid(encPass, RAW_PASS, %22another salt%22));%0A        assertFalse(passwordEncoder.isPasswordValid(encPass, %22wrong%22 + RAW_PASS, %22another salt%22));%0A    %7D%0A    %0A    %0A%0A%7D%0A

add test for PasswordEncoderImpl