From 4265e9c692198c52f6f2b19634c5083ce5fdf5df Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Wed, 3 Jul 2013 15:18:20 +0200 Subject: [PATCH] Optimize imports in payment channels. --- .../channels/ChannelConnectionTest.java | 34 +++++-------------- .../protocols/channels/ChannelTestUtils.java | 1 - .../channels/PaymentChannelStateTest.java | 18 ++++------ 3 files changed, 16 insertions(+), 37 deletions(-) diff --git a/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelConnectionTest.java b/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelConnectionTest.java index 10dac087..707724e7 100644 --- a/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelConnectionTest.java +++ b/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelConnectionTest.java @@ -16,15 +16,6 @@ package com.google.bitcoin.protocols.channels; -import java.io.File; -import java.math.BigInteger; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import javax.annotation.Nullable; - import com.google.bitcoin.core.*; import com.google.bitcoin.utils.Locks; import com.google.common.util.concurrent.ListenableFuture; @@ -35,6 +26,15 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import javax.annotation.Nullable; +import java.io.File; +import java.math.BigInteger; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + import static com.google.bitcoin.protocols.channels.PaymentChannelCloseException.CloseReason; import static org.bitcoin.paymentchannel.Protos.TwoWayChannelMessage.MessageType; import static org.junit.Assert.*; @@ -46,22 +46,6 @@ public class ChannelConnectionTest extends TestWithWallet { private TransactionBroadcaster mockBroadcaster; private Semaphore broadcastTxPause; - private interface PaymentChannelClientReceiver { - void receiveMessage(Protos.TwoWayChannelMessage msg); - void connectionOpen(); - void connectionClosed(); - void close(); - } - private class PaymentChannelClientReceiverImpl implements PaymentChannelClientReceiver { - private PaymentChannelClient client; - public PaymentChannelClientReceiverImpl(PaymentChannelClient client) { this.client = client; } - public void receiveMessage(Protos.TwoWayChannelMessage msg) { client.receiveMessage(msg); } - public void connectionOpen() { client.connectionOpen(); } - public void connectionClosed() { client.connectionClosed(); } - public void close() { client.close(); } - } - private PaymentChannelClientReceiver sendClient; - @Before public void setUp() throws Exception { super.setUp(); diff --git a/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelTestUtils.java b/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelTestUtils.java index 422c127c..13fd0b1a 100644 --- a/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelTestUtils.java +++ b/core/src/test/java/com/google/bitcoin/protocols/channels/ChannelTestUtils.java @@ -11,7 +11,6 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; /** * Various mock objects and utilities for testing payment channels code. diff --git a/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java b/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java index 1f9faa99..ec4d6ee5 100644 --- a/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java +++ b/core/src/test/java/com/google/bitcoin/protocols/channels/PaymentChannelStateTest.java @@ -16,28 +16,24 @@ package com.google.bitcoin.protocols.channels; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.LinkedBlockingQueue; - import com.google.bitcoin.core.*; import com.google.bitcoin.script.Script; import com.google.bitcoin.script.ScriptBuilder; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; -import org.easymock.Capture; -import org.easymock.IMocksControl; import org.junit.Before; import org.junit.Test; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Iterator; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.LinkedBlockingQueue; + import static com.google.bitcoin.core.TestUtils.createFakeTx; import static com.google.bitcoin.core.TestUtils.makeSolvedTestBlock; -import static org.easymock.EasyMock.*; import static org.junit.Assert.*; public class PaymentChannelStateTest extends TestWithWallet {