Skip to content
This repository has been archived by the owner on Oct 24, 2020. It is now read-only.

junit tests fail #3

Open
spicylobe opened this issue Jan 20, 2016 · 3 comments
Open

junit tests fail #3

spicylobe opened this issue Jan 20, 2016 · 3 comments

Comments

@spicylobe
Copy link

Multiple junit tests fail, both from the IDE and from "mvn clean install". For instance:

java.lang.ArrayIndexOutOfBoundsException: 0
at com.blockcypher.utils.sign.SignUtils.getBytesFromBase58Key(SignUtils.java:97)
at com.blockcypher.utils.sign.SignUtils.sign(SignUtils.java:50)
at com.blockcypher.utils.sign.SignUtils.signWithBase58KeyWithPubKey(SignUtils.java:40)
at com.blockcypher.service.TransactionServiceTest.testNewTransactionFromInputs(TransactionServiceTest.java:75)

and

java.lang.ArrayIndexOutOfBoundsException: 0
at com.blockcypher.utils.sign.SignUtils.getBytesFromBase58Key(SignUtils.java:97)
at com.blockcypher.utils.sign.SignUtils.sign(SignUtils.java:50)
at com.blockcypher.utils.sign.SignUtils.signWithBase58KeyWithPubKey(SignUtils.java:40)
at com.blockcypher.service.MultiSigTest.testMultiSigWithWebsocketOnConfirmedTransaction(MultiSigTest.java:57)

and

junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:55)
at junit.framework.Assert.assertTrue(Assert.java:22)
at junit.framework.Assert.assertNotNull(Assert.java:256)
at junit.framework.Assert.assertNotNull(Assert.java:248)
at com.blockcypher.service.AddressServiceTest.testGetAddress(AddressServiceTest.java:51)

@sebay
Copy link
Contributor

sebay commented Jan 20, 2016

Hi spicylobe,
Did you put your own private key in:

public class AbstractServiceTest {

// In order to signWithBase58Key.. Of course do not store this is plain your java code... This is for test only!
protected static final String MY_PRIVATE_KEY = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

@spicylobe
Copy link
Author

I wouldn't expect to have to modify any code just to get unit tests to run. Why not include a valid private key that was generated only for use in unit tests? It seems like you could then test many additional elements that require matching key pairs.

@sebay
Copy link
Contributor

sebay commented Jan 20, 2016

Fair enough. Will try to do this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants