### Question:
RecoveryCodeGenerator { public String generateCode(CodeGeneratorSource alphabet, int length) { Reject.ifTrue(length < 1); Reject.ifNull(alphabet); StringBuilder codeBuilder = new StringBuilder(length); String chars = alphabet.getChars(); for (int k = 0; k < length; k++) { codeBuilder.append(chars.charAt(secureRandom.nextInt(chars.length()))); } return codeBuilder.toString(); } RecoveryCodeGenerator(SecureRandom secureRandom, int retryMaximum); @Inject  RecoveryCodeGenerator(SecureRandom secureRandom); String generateCode(CodeGeneratorSource alphabet, int length); String generateDelimitedCode(CodeGeneratorSource alphabet, char delimiter, int... groups); String generateDelimitedCodeWithSpecifics(CodeGeneratorSource alphabet, char delimiter,
                                                       Map<Integer, Character> specifics, int... groups); String[] generateCodes(int numCodes, CodeGeneratorSource alphabet, boolean allowDuplicates); String[] generateCodes(int numCodes, CodeGeneratorSource alphabet, int length, boolean allowDuplicates); String[] generateDelimitedCodes(int numCodes, CodeGeneratorSource alphabet,
                                           char delimiter, boolean allowDuplicates, int... groups); String[] generateDelimitedCodesWithSpecifics(int numCodes, CodeGeneratorSource alphabet,
                                                        char delimiter, Map<Integer, Character> specifics,
                                                        boolean allowDuplicates, int... groups); final static int DEFAULT_LENGTH; final static int DEFAULT_RETRIES; }### Answer:
@Test (expectedExceptions = IllegalArgumentException.class) public void shouldErrorRequestedLengthTooSmall2() throws CodeException { recoveryCodeGenerator.generateCode(new TestAlphabet(), 0); }
@Test (expectedExceptions = NullPointerException.class) public void shouldErrorNullAlphabet4() throws CodeException { recoveryCodeGenerator.generateCode(null, 10); }