Search in sources :

Example 1 with RandomImpl

use of org.apache.harmony.security.tests.support.RandomImpl in project robovm by robovm.

the class ProviderServiceTest method testNewInstance.

public void testNewInstance() throws Exception {
    Provider p = new MyProvider();
    Provider.Service s = new Provider.Service(p, "SecureRandom", "algorithm", "org.apache.harmony.security.tests.support.RandomImpl", null, null);
    Object o = s.newInstance(null);
    assertTrue("incorrect instance", o instanceof RandomImpl);
    try {
        o = s.newInstance(new Object());
        fail("No expected NoSuchAlgorithmException");
    } catch (NoSuchAlgorithmException e) {
    }
}
Also used : RandomImpl(org.apache.harmony.security.tests.support.RandomImpl) Service(java.security.Provider.Service) Service(java.security.Provider.Service) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Provider(java.security.Provider)

Aggregations

NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Provider (java.security.Provider)1 Service (java.security.Provider.Service)1 RandomImpl (org.apache.harmony.security.tests.support.RandomImpl)1