Code example for SecureRandom

Methods: getAlgorithm

0
        assertNull("Non null provider", new SecureRandom().getProvider());
	} 
	 
	public final void testGetAlgorithm() { 
        //test default implementation 
		SecureRandom sr = new SecureRandom();
        assertEquals("Incorrect algorithm", "SHA1PRNG", sr.getAlgorithm());
        assertNull("Incorrect provider", sr.getProvider());
         
        //just in case 
        sr.nextBytes(new byte[100]);
	} 
	 
	/* 
	 * Class under test for void setSeed(byte[]) 
	 */ 
	public final void testSetSeedbyteArray() { 
		SecureRandom sr = new SecureRandom();
 
		//Not specified behavior: throws NullPointerException if bytes is null 
		try {