### Question:
KeyPairUtil { public static SECP256K1.KeyPair loadKeyPair(final File keyFile) { final SECP256K1.KeyPair key; if (keyFile.exists()) { key = load(keyFile); LOG.info( "Loaded public key {} from {}", key.getPublicKey().toString(), keyFile.getAbsolutePath()); } else { key = SECP256K1.KeyPair.generate(); try { storeKeyPair(key, keyFile); } catch (IOException e) { throw new IllegalArgumentException("Cannot store generated private key."); } LOG.info( "Generated new public key {} and stored it to {}", key.getPublicKey().toString(), keyFile.getAbsolutePath()); } return key; }  static String loadResourceFile(final String resourcePath); static SECP256K1.KeyPair loadKeyPairFromResource(final String resourcePath); static SECP256K1.KeyPair loadKeyPair(final File keyFile); static SECP256K1.KeyPair loadKeyPair(final Path homeDirectory); static File getDefaultKeyFile(final Path homeDirectory); static SECP256K1.KeyPair load(final File file);  }### Answer:
@Test public void shouldLoadValidKeyPair() throws Exception { assertThat( KeyPairUtil.loadKeyPair( new File(this.getClass().getResource("/validPrivateKey.txt").toURI()))) .isNotNull(); }
@Test(expected = IllegalArgumentException.class) public void shouldNotLoadInvalidKeyPair() throws Exception { KeyPairUtil.loadKeyPair( new File(this.getClass().getResource("/invalidPrivateKey.txt").toURI())); }