Code example for RC5ParameterSpec

Methods: equals

0
                ps.getWordSize() == wordSize);
    } 
 
    /** 
     * getIV() method testing. Tests that returned array is equal to the 
     * array specified in the constructor. Checks that modification 
     * of returned array does not affect the internal array. Also it checks 
     * that getIV() method returns null if iv is not specified. 
     */ 
    @TestTargetNew( 
        level = TestLevel.COMPLETE, 
        notes = "", 
        method = "getIV", 
        args = {} 
    ) 
    public void testGetIV() { 
        int version = 1;
        int rounds = 5;
        int wordSize = 16;
        byte[] iv = {1, 2, 3, 4};
 
        RC5ParameterSpec ps = new RC5ParameterSpec(version, rounds,
                                                            wordSize, 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 RC5ParameterSpec(version, rounds, wordSize);
        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}
    )