OSDN Git Service

add UTXOTest class
authorsuccessli <successli@outlook.com>
Thu, 31 May 2018 02:21:05 +0000 (10:21 +0800)
committersuccessli <successli@outlook.com>
Thu, 31 May 2018 02:21:05 +0000 (10:21 +0800)
src/main/java/io/bytom/api/UnspentOutput.java
src/test/java/io/bytom/integration/UTXOTest.java [new file with mode: 0644]

index df595c5..933b77f 100644 (file)
@@ -116,12 +116,13 @@ public class UnspentOutput {
          */
         public List<UnspentOutput> list(Client client) throws BytomException {
 
-            // TODO: 2018/5/21 need to tx and test
             Type listType = new ParameterizedTypeImpl(List.class, new Class[]{UnspentOutput.class});
             List<UnspentOutput> unspentOutputList = client.request("list-unspent-outputs", this, listType);
             logger.info("list-unspent-outputs:");
             logger.info("size of unspentOutputList:" + unspentOutputList.size());
-            logger.info(unspentOutputList.get(0).toJson());
+            for (UnspentOutput UTXO : unspentOutputList) {
+                logger.info(UTXO.toJson());
+            }
 
             return unspentOutputList;
         }
diff --git a/src/test/java/io/bytom/integration/UTXOTest.java b/src/test/java/io/bytom/integration/UTXOTest.java
new file mode 100644 (file)
index 0000000..2252e91
--- /dev/null
@@ -0,0 +1,32 @@
+package io.bytom.integration;
+
+import io.bytom.TestUtils;
+import io.bytom.api.Balance;
+import io.bytom.api.UnspentOutput;
+import io.bytom.exception.BytomException;
+import io.bytom.http.Client;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+public class UTXOTest {
+
+    static Client client;
+
+    static {
+        try {
+            client = TestUtils.generateClient();
+        } catch (BytomException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @Test
+    public void testBalanceList() throws Exception {
+        List<UnspentOutput> UTXOList = new UnspentOutput.QueryBuilder().list(client);
+        Assert.assertNotNull(UTXOList);
+    }
+
+}