Code example for RC2ParameterSpec

Methods: equals

0
     * that getIV() method returns null if iv is not specified. 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "getIV", 
        args = {} 
    ) 
    public void testGetIV() { 
        int effectiveKeyBits = 10;
        byte[] iv = new byte[] {1, 2, 3, 4, 5, 6, 7, 8};
 
        RC2ParameterSpec ps = new RC2ParameterSpec(effectiveKeyBits, iv);
        byte[] result = ps.getIV();
        if (! Arrays.equals(iv, result)) {
            fail("The returned iv is not equal to the specified "
                    + "in the constructor."); 
        } 
        result[0] ++;
        assertFalse("The change of returned by getIV() method iv "
                    + "should not cause the change of internal array.", 
                    result[0] == ps.getIV()[0]);
        ps = new RC2ParameterSpec(effectiveKeyBits);
        assertNull("The getIV() method should return null if the parameter "
                    + "set does not contain iv.", ps.getIV());
    } 
 
    /** 
     * equals(Object obj) method testing. Tests the correctness of equal 
     * operation: it should be reflexive, symmetric, transitive, consistent 
     * and should be false on null object. 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "equals", 
        args = {java.lang.Object.class}
    ) 
    public void testEquals() { 
        int effectiveKeyBits = 10;