TestWithWallet: Reset mocking to prevent an invalid mock time.
@@ -25,6 +25,7 @@ import org.bitcoinj.core.Context;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Transaction;
+import org.bitcoinj.core.Utils;
import org.bitcoinj.core.VerificationException;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.UnitTestParams;
@@ -33,6 +34,7 @@ import org.bitcoinj.store.BlockStore;
import org.bitcoinj.store.MemoryBlockStore;
import org.bitcoinj.utils.BriefLogFormatter;
import org.bitcoinj.wallet.Wallet;
+import org.junit.BeforeClass;
import javax.annotation.Nullable;
@@ -48,8 +50,8 @@ import static org.bitcoinj.testing.FakeTxBuilder.createFakeTx;
* fee per kilobyte to zero in setUp.
*/
public class TestWithWallet {
- protected static final NetworkParameters UNITTEST = UnitTestParams.get();
- protected static final NetworkParameters MAINNET = MainNetParams.get();
+ protected static NetworkParameters UNITTEST;
+ protected static NetworkParameters MAINNET;
protected ECKey myKey;
protected Address myAddress;
@@ -57,6 +59,13 @@ public class TestWithWallet {
protected BlockChain chain;
protected BlockStore blockStore;
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ Utils.resetMocking();
+ UNITTEST = UnitTestParams.get();
+ MAINNET = MainNetParams.get();
+ }
+
public void setUp() throws Exception {
BriefLogFormatter.init();
Context.propagate(new Context(UNITTEST, 100, Coin.ZERO, false));
