Search in sources :

Example 1 with AlgorithmParameterGeneratorSpi

use of java.security.AlgorithmParameterGeneratorSpi in project robovm by robovm.

the class myAlgPG method testConstructor.

/**
     * Test for <code>AlgorithmParameterGenerator</code> constructor
     * Assertion: returns AlgorithmParameterGenerator object
     */
public void testConstructor() throws NoSuchAlgorithmException {
    if (!DSASupported) {
        fail(validAlgName + " algorithm is not supported");
        return;
    }
    AlgorithmParameterGeneratorSpi spi = new MyAlgorithmParameterGeneratorSpi();
    AlgorithmParameterGenerator apg = new myAlgPG(spi, validProvider, validAlgName);
    assertEquals("Incorrect algorithm", apg.getAlgorithm(), validAlgName);
    assertEquals("Incorrect provider", apg.getProvider(), validProvider);
    try {
        apg.init(-10, null);
        fail("IllegalArgumentException must be thrown");
    } catch (IllegalArgumentException e) {
    }
    apg = new myAlgPG(null, null, null);
    assertNull("Incorrect algorithm", apg.getAlgorithm());
    assertNull("Incorrect provider", apg.getProvider());
    try {
        apg.init(-10, null);
        fail("NullPointerException must be thrown");
    } catch (NullPointerException e) {
    }
}
Also used : MyAlgorithmParameterGeneratorSpi(org.apache.harmony.security.tests.support.MyAlgorithmParameterGeneratorSpi) AlgorithmParameterGenerator(java.security.AlgorithmParameterGenerator) AlgorithmParameterGeneratorSpi(java.security.AlgorithmParameterGeneratorSpi) MyAlgorithmParameterGeneratorSpi(org.apache.harmony.security.tests.support.MyAlgorithmParameterGeneratorSpi)

Aggregations

AlgorithmParameterGenerator (java.security.AlgorithmParameterGenerator)1 AlgorithmParameterGeneratorSpi (java.security.AlgorithmParameterGeneratorSpi)1 MyAlgorithmParameterGeneratorSpi (org.apache.harmony.security.tests.support.MyAlgorithmParameterGeneratorSpi)1