### Question:
KeyPair { public PublicKey getPublicKey() { Point point = new Point(); byte[] key = publicKey != null ? publicKey : point.mult(secretKey).toBytes(); return new PublicKey(key); } KeyPair();  KeyPair(byte[] seed);  KeyPair(String secretKey, Encoder encoder); PublicKey getPublicKey(); PrivateKey getPrivateKey();  }### Answer:
@Test public void testGeneratePublicKey() throws Exception { try { byte[] pk = HEX.decode(BOB_PRIVATE_KEY); KeyPair key = new KeyPair(pk); assertTrue(key.getPublicKey() != null); } catch (Exception e) { fail("Should return a valid key size"); } }
@Test public void testPrivateKeyToBytes() throws Exception { try { KeyPair key = new KeyPair(HEX.decode(BOB_SEED)); assertTrue("Correct private key expected", Arrays.equals(HEX.decode(BOB_ENCRYPTION_PUBLIC_KEY), key.getPublicKey().toBytes())); } catch (Exception e) { fail("Should return a valid key size"); } }
@Test public void testPublicKeyToString() throws Exception { try { KeyPair key = new KeyPair(HEX.decode(BOB_SEED)); assertEquals("Correct public key expected", BOB_ENCRYPTION_PUBLIC_KEY, key.getPublicKey().toString()); } catch (Exception e) { fail("Should return a valid key size"); } }
@Test public void testPublicKeyToBytes() throws Exception { try { KeyPair key = new KeyPair(HEX.decode(BOB_SEED)); assertTrue("Correct public key expected", Arrays.equals(HEX.decode(BOB_ENCRYPTION_PUBLIC_KEY), key.getPublicKey().toBytes())); } catch (Exception e) { fail("Should return a valid key size"); } }