APS101, Winter 2009: Assignment 2 Testing the Spy class methods constructor (at least 5 cases) * when the record of all code numbers is empty ("") * when there is at least one code number in the record, but the user specifies a code number that already exists in the record. * when there is at least one code number in the record, and the user specifies a new code number: - the new code number is smaller than any code number in the record - the new code number is greater than any code number in the record - the new code number is smaller than at least one code number in the record, and greater than at least one code number in the record. charToBinary (at least 1 case) * any character (although you could test 1 character with a low ASCII value, ex. "!" -> 33, and another character with a higher ASCII value, ex. "z" -> 122, to see whether the resulting String is "padded" with 0's appropriately, so that it is always exactly 8-bits long) decrypt (at least 3 cases) * when the encrypted String is empty ("") - you can use any key * when the encrypted String is non-empty, and the right key is used to decrypt it * when the encrypted String is non-empty, but the wrong key is used to decrypt it (you can test this by checking whether the decrypted String is NOT equal to the original message, OR you can actually check whether the decrypted String equals a specific INCORRECT value) encrypt (at least 3 cases) * when the message is empty ("") * when the message is of length 16 characters or less (128-bit key doesn't need to be stretched) * when the message is longer than 16 characters (128-bit key needs to be stretched at least once) (you could also test it with a message that is 273 characters long, which is the upper bound on the length of the message). exclusiveOr (at least 4 cases, although you could put them in 1 JUnit tester method) * when i = 0 and j = 0 * when i = 0 and j = 1 * when i = 1 and j = 0 * when i = 1 and j = 1 getAllCodeNumbers (at least 1 case) * any situation getCodeNumber (at least 1 case) * any situation removeCodeNumber (at least 3 cases) * when the record of all code numbers is empty ("") -> returns false * when there is at least one code number in the record, but the user specifies a code number that does not exist in the record * when there is at least one code number in the record, and the user specifies a code number that exists in the record stretch (at least 3 cases) * when the specified length is less than the length of the key * when the specified length is equal to the length of the key * when the specified length is greater than the length of the key (although be careful not to run into the problem of trying to divide a key with an ODD number of bits into two EVEN halves).