/*
 * PowerAuth Crypto Library
 * Copyright 2018 Wultra s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.getlime.security.powerauth.crypto.generator;

import io.getlime.security.powerauth.crypto.lib.generator.IdentifierGenerator;
import io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException;
import org.junit.Test;

import static junit.framework.TestCase.assertTrue;

/**
 * Test activation code generator.
 */
public class ActivationCodeGeneratorTest {

    /**
     * Test generator of activation codes and validate CRC-16 checksum.
     */
    @Test
    public void testActivationCodeGenerator() throws CryptoProviderException {
        IdentifierGenerator identifierGenerator = new IdentifierGenerator();
        int testRounds = 10000;
        for (int i = 0; i < testRounds; i++) {
            String activationCode = identifierGenerator.generateActivationCode();
            assertTrue(identifierGenerator.validateActivationCode(activationCode));
        }
    }

}

@@ -854,18 +854,134 @@
 org.
-junit.Test
+bouncycastle.jce.provider.BouncyCastleProvider;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.security.Security
 ;%0A%0Ai
@@ -1118,16 +1118,216 @@
 Test %7B%0A%0A
+    /**%0A     * Register crypto providers.%0A     */%0A    @Before%0A    public void setUp() %7B%0A        // Add Bouncy Castle Security Provider%0A        Security.addProvider(new BouncyCastleProvider());%0A    %7D%0A%0A
     /**%0A

Fix failing build