question: public void testIsParityAdjusted ( ) { try { DESedeKeySpec . isParityAdjusted ( null , 1 ) ; fail ( "Should raise an NullPointerException " + "in case of null byte array." ) ; } catch ( NullPointerException e ) { } catch ( InvalidKeyException e ) { fail ( "Should raise an NullPointerException " + "in case of null byte array." ) ; } byte [ ] key = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 } ; try { DESedeKeySpec . isParityAdjusted ( key , 1 ) ; fail ( "Should raise an InvalidKeyException " + "in case of short byte array." ) ; } catch ( NullPointerException e ) { fail ( "Unexpected NullPointerException was thrown." ) ; } catch ( InvalidKeyException e ) { } byte [ ] key_not_pa = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , 1 , 2 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , 1 , 2 } ; try { assertFalse ( "Method returns true when false is expected." , DESedeKeySpec . isParityAdjusted ( key_not_pa , 0 ) ) ; } catch ( NullPointerException e ) { fail ( "Unexpected NullPointerException was thrown." ) ; } catch ( InvalidKeyException e ) { fail ( "Unexpected InvalidKeyException was thrown." ) ; } byte [ ] key_pa = { ( byte ) 128 , ( byte ) 131 , ( byte ) 133 , ( byte ) 134 , ( byte ) 137 , ( byte ) 138 , ( byte ) 140 , ( byte ) 143 , ( byte ) 145 , ( byte ) 146 , ( byte ) 148 , ( byte ) 151 , ( byte ) 152 , ( byte ) 155 , ( byte ) 157 , ( byte ) 158 , ( byte ) 161 , ( byte ) 162 , ( byte ) 164 , ( byte ) 167 , ( byte ) 168 , ( byte ) 171 , ( byte ) 173 , ( byte ) 174 } ; try { assertTrue ( "Method returns false when true is expected." , DESedeKeySpec . isParityAdjusted ( key_pa , 0 ) ) ; } catch ( NullPointerException e ) { fail ( "Unexpected NullPointerException was thrown." ) ; } catch ( InvalidKeyException e ) { fail ( "Unexpected InvalidKeyException was thrown." ) ; } }
target:  isParityAdjusted(byte[] key, offset) method testing. Tests if the method throws appropriate exceptions on incorrect byte array, if it returns false on the key which is not parity adjusted, and if it returns true on parity adjusted key.