### Question:
MnemonicUtil { public static void validateMnemonics(List<String> mnemonicCodes) { try { MnemonicCode.INSTANCE.check(mnemonicCodes); } catch (org.bitcoinj.crypto.MnemonicException.MnemonicLengthException e) { throw new TokenException(Messages.MNEMONIC_INVALID_LENGTH); } catch (org.bitcoinj.crypto.MnemonicException.MnemonicWordException e) { throw new TokenException(Messages.MNEMONIC_BAD_WORD); } catch (Exception e) { throw new TokenException(Messages.MNEMONIC_CHECKSUM); } }  static void validateMnemonics(List<String> mnemonicCodes); static List<String> randomMnemonicCodes();  }### Answer:
@Test public void testValidateMnemonic() { try { List<String> mnemonic = Arrays.asList(SampleKey.MNEMONIC.split(" ")); MnemonicUtil.validateMnemonics(mnemonic); assertTrue(true); } catch (TokenException ex) { fail("Should not throw any exception"); } }
@Test public void testMnemonicShortLengthException() { thrown.expect(TokenException.class); thrown.expectMessage(Messages.MNEMONIC_INVALID_LENGTH); String test = "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong"; List<String> mnemonic = Arrays.asList(test.split(" ")); MnemonicUtil.validateMnemonics(mnemonic); fail("Should throw a exception"); }
@Test public void testMnemonicLongLengthException() { thrown.expect(TokenException.class); thrown.expectMessage(Messages.MNEMONIC_INVALID_LENGTH); String test = "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong"; List<String> mnemonic = Arrays.asList(test.split(" ")); MnemonicUtil.validateMnemonics(mnemonic); fail("Should throw a exception"); }
@Test public void testMnemonicBadWordException() { thrown.expect(TokenException.class); thrown.expectMessage(Messages.MNEMONIC_BAD_WORD); String test = "hot zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong"; List<String> mnemonic = Arrays.asList(test.split(" ")); MnemonicUtil.validateMnemonics(mnemonic); fail("Should throw a exception"); }
@Test public void testMnemonicBadChecksumException() { thrown.expect(TokenException.class); thrown.expectMessage(Messages.MNEMONIC_CHECKSUM); String test = "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo"; List<String> mnemonic = Arrays.asList(test.split(" ")); MnemonicUtil.validateMnemonics(mnemonic); fail("Should throw a exception"); }