@@ -0,0 +1,2436 @@
+package com.samhg.authentication.generation;%0A%0Aimport com.google.common.primitives.Longs;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0A%0A/**%0A * All expected values generated using FreeOTP by Red Hat%0A */%0Apublic final class PasswordFactoryTest %7B%0A%0A    @Test%0A    public void testGeneratePassword_HmacSHA1_6() %7B%0A        testGeneratePassword(HmacAlgorithm.SHA1, 6, 0, %22257225%22);%0A        testGeneratePassword(HmacAlgorithm.SHA1, 6, 1, %22299396%22);%0A        testGeneratePassword(HmacAlgorithm.SHA1, 6, 2, %22538728%22);%0A    %7D%0A%0A    @Test%0A    public void testGeneratePassword_HmacSHA1_8() %7B%0A        testGeneratePassword(HmacAlgorithm.SHA1, 8, 3, %2247975654%22);%0A        testGeneratePassword(HmacAlgorithm.SHA1, 8, 4, %2256886874%22);%0A        testGeneratePassword(HmacAlgorithm.SHA1, 8, 5, %2236361366%22);%0A    %7D%0A%0A    @Test%0A    public void testGeneratePassword_HmacSHA256_6() %7B%0A        testGeneratePassword(HmacAlgorithm.SHA256, 6, 6, %22768910%22);%0A        testGeneratePassword(HmacAlgorithm.SHA256, 6, 7, %22620107%22);%0A        testGeneratePassword(HmacAlgorithm.SHA256, 6, 8, %22666127%22);%0A    %7D%0A%0A    @Test%0A    public void testGeneratePassword_HmacSHA256_8() %7B%0A        testGeneratePassword(HmacAlgorithm.SHA256, 8, 9, %2294313931%22);%0A        testGeneratePassword(HmacAlgorithm.SHA256, 8, 10, %2295873947%22);%0A        testGeneratePassword(HmacAlgorithm.SHA256, 8, 11, %2240584582%22);%0A    %7D%0A%0A    @Test%0A    public void testGeneratePassword_HmacSHA512_6() %7B%0A        testGeneratePassword(HmacAlgorithm.SHA512, 6, 12, %22064583%22);%0A        testGeneratePassword(HmacAlgorithm.SHA512, 6, 13, %22304443%22);%0A        testGeneratePassword(HmacAlgorithm.SHA512, 6, 14, %22995816%22);%0A    %7D%0A%0A    @Test%0A    public void testGeneratePassword_HmacSHA512_8() %7B%0A        testGeneratePassword(HmacAlgorithm.SHA512, 8, 15, %2262749084%22);%0A        testGeneratePassword(HmacAlgorithm.SHA512, 8, 16, %2258980423%22);%0A        testGeneratePassword(HmacAlgorithm.SHA512, 8, 17, %2277809971%22);%0A    %7D%0A%0A    private static final byte%5B%5D SECRET_KEY = %7B 20, -37, 28, 73, -53, 23, -2, -59, 70, 89 %7D;%0A%0A    private void testGeneratePassword(HmacAlgorithm algorithm, int digits, long counter, String expectedValue) %7B%0A        byte%5B%5D movingFactor = Longs.toByteArray(counter);%0A%0A        PasswordFactory factory = new PasswordFactory();%0A        String actualValue = factory.generatePassword(SECRET_KEY, movingFactor, algorithm, digits);%0A%0A        assertEquals(expectedValue, actualValue);%0A    %7D%0A%0A%7D

Add PasswordFactoryTest unit test