mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 18:00:39 +01:00
BlockChainTest: use DateTimeFormatter.ISO_INSTANT
to parse an instant
This commit is contained in:
parent
2cf4f17458
commit
35b7532e11
@ -39,12 +39,10 @@ import org.junit.Test;
|
|||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static org.bitcoinj.base.Coin.COIN;
|
import static org.bitcoinj.base.Coin.COIN;
|
||||||
@ -441,8 +439,7 @@ public class BlockChainTest {
|
|||||||
BlockChain prod = new BlockChain(MAINNET, new MemoryBlockStore(MAINNET));
|
BlockChain prod = new BlockChain(MAINNET, new MemoryBlockStore(MAINNET));
|
||||||
Instant t = prod.estimateBlockTimeInstant(200000);
|
Instant t = prod.estimateBlockTimeInstant(200000);
|
||||||
// The actual date of block 200,000 was 2012-09-22 10:47:00
|
// The actual date of block 200,000 was 2012-09-22 10:47:00
|
||||||
Instant expected = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US)
|
Instant expected = Instant.from(DateTimeFormatter.ISO_INSTANT.parse("2012-10-23T15:35:05Z"));
|
||||||
.parse("2012-10-23T08:35:05.000-0700").toInstant();
|
|
||||||
assertEquals(expected, t);
|
assertEquals(expected, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user