From 915b446d1de9862b0d40130e5c73b2efd37935cc Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Wed, 23 May 2018 10:48:07 -0500 Subject: [PATCH] Extended the BrainKeyTest in order to cover OpenLedger's accounts --- .../cy/agorise/graphenej/BrainKeyTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java b/graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java index c0a1342..a5915af 100644 --- a/graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java +++ b/graphenej/src/test/java/cy/agorise/graphenej/BrainKeyTest.java @@ -10,6 +10,9 @@ import org.junit.Test; */ public class BrainKeyTest { public final String TEST_BRAINKEY = "BARIC BICKERN LITZ TIPFUL JINGLED POOL TUMBAK PURIST APOPYLE DURAIN SATLIJK FAUCAL"; + + public final String TEST_BRAINKEY_OPENLEDGER = "ona refan abscise neebor battik terbia bandit sundra gasser debar phytol frat hauler accede primy garland"; + private BrainKey mBrainKey; @Before @@ -17,6 +20,9 @@ public class BrainKeyTest { mBrainKey = new BrainKey(TEST_BRAINKEY, BrainKey.DEFAULT_SEQUENCE_NUMBER); } + /** + * Test making sure that a simple brainkey can successfully generate the expected public address + */ @Test public void testAddress(){ Address address = mBrainKey.getPublicAddress(Address.BITSHARES_PREFIX); @@ -24,4 +30,25 @@ public class BrainKeyTest { "BTS61UqqgE3ARuTGcckzARsdQm4EMFdBEwYyi1pbwyHrZZWrCDhT2", address.toString()); } + + /** + * Test making sure that a OpenLedger's brainkey can successfully generate the given + * 'owner' and 'active' keys. + */ + @Test + public void testOpenledgerAddress(){ + BrainKey brainKey1 = new BrainKey(TEST_BRAINKEY_OPENLEDGER, 0); + BrainKey brainKey2 = new BrainKey(TEST_BRAINKEY_OPENLEDGER, 1); + + Address ownerAddress = brainKey1.getPublicAddress(Address.BITSHARES_PREFIX); + Address activeAddress = brainKey2.getPublicAddress(Address.BITSHARES_PREFIX); + + Assert.assertEquals("Owner address matches", + "BTS6dqT3J7tUcZP6xHo2mHkL8tq8zw5TQgGd6ntRMXH1EoNsCWTzm", + ownerAddress.toString()); + + Assert.assertEquals("Active address matches", + "BTS6DKvgY3yPyN7wKrhBGYhrnghhLSVCYz3ugUdi9pDPkicS6B7N2", + activeAddress.toString()); + } } \ No newline at end of file