mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2025-10-16 11:45:37 +00:00
Delete skipTests flag and separate unit and integration tests
This commit is contained in:
parent
c668a41784
commit
8e12cbb758
@ -16,7 +16,7 @@ before_install:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
# Override default travis to use the maven wrapper
|
# Override default travis to use the maven wrapper
|
||||||
- ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
- ./mvnw install -Dmaven.javadoc.skip=true -B -V
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- .travis/publish.sh
|
- .travis/publish.sh
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package jota;
|
package jota;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import jota.category.IntegrationTest;
|
||||||
import jota.dto.response.*;
|
import jota.dto.response.*;
|
||||||
import jota.error.ArgumentException;
|
import jota.error.ArgumentException;
|
||||||
import jota.model.Bundle;
|
import jota.model.Bundle;
|
||||||
@ -13,6 +14,7 @@ import org.junit.Assert;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -113,6 +115,7 @@ public class IotaAPITest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetInputs() throws ArgumentException {
|
public void shouldGetInputs() throws ArgumentException {
|
||||||
GetBalancesAndFormatResponse res = iotaAPI.getInputs(TEST_SEED1, 2, 0, 0, 0);
|
GetBalancesAndFormatResponse res = iotaAPI.getInputs(TEST_SEED1, 2, 0, 0, 0);
|
||||||
System.out.println(res);
|
System.out.println(res);
|
||||||
@ -153,6 +156,7 @@ public class IotaAPITest {
|
|||||||
|
|
||||||
//seed contains 0 balance
|
//seed contains 0 balance
|
||||||
@Test(expected = IllegalStateException.class)
|
@Test(expected = IllegalStateException.class)
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldPrepareTransfer() throws ArgumentException {
|
public void shouldPrepareTransfer() throws ArgumentException {
|
||||||
List<Transfer> transfers = new ArrayList<>();
|
List<Transfer> transfers = new ArrayList<>();
|
||||||
|
|
||||||
@ -165,6 +169,7 @@ public class IotaAPITest {
|
|||||||
|
|
||||||
//seed contains 0 balance
|
//seed contains 0 balance
|
||||||
@Test(expected = IllegalStateException.class)
|
@Test(expected = IllegalStateException.class)
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldPrepareTransferWithInputs() throws ArgumentException {
|
public void shouldPrepareTransferWithInputs() throws ArgumentException {
|
||||||
List<Input> inputlist = new ArrayList<>();
|
List<Input> inputlist = new ArrayList<>();
|
||||||
List<Transfer> transfers = new ArrayList<>();
|
List<Transfer> transfers = new ArrayList<>();
|
||||||
@ -181,12 +186,14 @@ public class IotaAPITest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetLastInclusionState() throws ArgumentException {
|
public void shouldGetLastInclusionState() throws ArgumentException {
|
||||||
GetInclusionStateResponse res = iotaAPI.getLatestInclusion(new String[]{TEST_HASH});
|
GetInclusionStateResponse res = iotaAPI.getLatestInclusion(new String[]{TEST_HASH});
|
||||||
assertThat(res.getStates(), IsNull.notNullValue());
|
assertThat(res.getStates(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldFindTransactionObjects() throws ArgumentException {
|
public void shouldFindTransactionObjects() throws ArgumentException {
|
||||||
List<Transaction> ftr = iotaAPI.findTransactionObjectsByAddresses(TEST_ADDRESSES);
|
List<Transaction> ftr = iotaAPI.findTransactionObjectsByAddresses(TEST_ADDRESSES);
|
||||||
System.out.println(ftr);
|
System.out.println(ftr);
|
||||||
@ -194,6 +201,7 @@ public class IotaAPITest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetAccountData() throws ArgumentException {
|
public void shouldGetAccountData() throws ArgumentException {
|
||||||
GetAccountDataResponse gad = iotaAPI.getAccountData(TEST_SEED1, 2, 0, true, 0, true, 0, 0, true, 0);
|
GetAccountDataResponse gad = iotaAPI.getAccountData(TEST_SEED1, 2, 0, true, 0, true, 0, 0, true, 0);
|
||||||
assertThat(gad, IsNull.notNullValue());
|
assertThat(gad, IsNull.notNullValue());
|
||||||
@ -206,6 +214,7 @@ public class IotaAPITest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetBundle() throws ArgumentException {
|
public void shouldGetBundle() throws ArgumentException {
|
||||||
GetBundleResponse gbr = iotaAPI.getBundle(TEST_HASH);
|
GetBundleResponse gbr = iotaAPI.getBundle(TEST_HASH);
|
||||||
System.out.println(gbr);
|
System.out.println(gbr);
|
||||||
@ -213,6 +222,7 @@ public class IotaAPITest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetTransfers() throws ArgumentException {
|
public void shouldGetTransfers() throws ArgumentException {
|
||||||
GetTransferResponse gtr = iotaAPI.getTransfers(TEST_SEED1, 2, 0, 0, false);
|
GetTransferResponse gtr = iotaAPI.getTransfers(TEST_SEED1, 2, 0, 0, false);
|
||||||
assertThat(gtr.getTransfers(), IsNull.notNullValue());
|
assertThat(gtr.getTransfers(), IsNull.notNullValue());
|
||||||
@ -239,11 +249,13 @@ public class IotaAPITest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test()
|
@Test()
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetTrytes() throws ArgumentException {
|
public void shouldGetTrytes() throws ArgumentException {
|
||||||
System.out.println(iotaAPI.getTrytes(TEST_HASH));
|
System.out.println(iotaAPI.getTrytes(TEST_HASH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test()
|
@Test()
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldBroadcastAndStore() throws ArgumentException {
|
public void shouldBroadcastAndStore() throws ArgumentException {
|
||||||
System.out.println(iotaAPI.broadcastAndStore(TEST_TRYTES));
|
System.out.println(iotaAPI.broadcastAndStore(TEST_TRYTES));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package jota;
|
package jota;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import jota.category.IntegrationTest;
|
||||||
import jota.dto.response.*;
|
import jota.dto.response.*;
|
||||||
import jota.error.ArgumentException;
|
import jota.error.ArgumentException;
|
||||||
import org.hamcrest.core.IsNull;
|
import org.hamcrest.core.IsNull;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
@ -27,6 +29,7 @@ public class IotaCoreApiTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetNodeInfo() {
|
public void shouldGetNodeInfo() {
|
||||||
GetNodeInfoResponse nodeInfo = proxy.getNodeInfo();
|
GetNodeInfoResponse nodeInfo = proxy.getNodeInfo();
|
||||||
System.out.println(new Gson().toJson(nodeInfo));
|
System.out.println(new Gson().toJson(nodeInfo));
|
||||||
@ -49,71 +52,83 @@ public class IotaCoreApiTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetNeighbors() {
|
public void shouldGetNeighbors() {
|
||||||
GetNeighborsResponse neighbors = proxy.getNeighbors();
|
GetNeighborsResponse neighbors = proxy.getNeighbors();
|
||||||
assertThat(neighbors.getNeighbors(), IsNull.notNullValue());
|
assertThat(neighbors.getNeighbors(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalAccessError.class)
|
@Test(expected = IllegalAccessError.class)
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldAddNeighbors() {
|
public void shouldAddNeighbors() {
|
||||||
AddNeighborsResponse res = proxy.addNeighbors("udp://8.8.8.8:14265");
|
AddNeighborsResponse res = proxy.addNeighbors("udp://8.8.8.8:14265");
|
||||||
assertThat(res, IsNull.notNullValue());
|
assertThat(res, IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalAccessError.class)
|
@Test(expected = IllegalAccessError.class)
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldRemoveNeighbors() {
|
public void shouldRemoveNeighbors() {
|
||||||
RemoveNeighborsResponse res = proxy.removeNeighbors("udp://8.8.8.8:14265");
|
RemoveNeighborsResponse res = proxy.removeNeighbors("udp://8.8.8.8:14265");
|
||||||
assertThat(res, IsNull.notNullValue());
|
assertThat(res, IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetTips() {
|
public void shouldGetTips() {
|
||||||
GetTipsResponse tips = proxy.getTips();
|
GetTipsResponse tips = proxy.getTips();
|
||||||
assertThat(tips, IsNull.notNullValue());
|
assertThat(tips, IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldFindTransactionsByAddresses() throws ArgumentException {
|
public void shouldFindTransactionsByAddresses() throws ArgumentException {
|
||||||
FindTransactionResponse trans = proxy.findTransactionsByAddresses(TEST_ADDRESS_WITH_CHECKSUM);
|
FindTransactionResponse trans = proxy.findTransactionsByAddresses(TEST_ADDRESS_WITH_CHECKSUM);
|
||||||
assertThat(trans.getHashes(), IsNull.notNullValue());
|
assertThat(trans.getHashes(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldFindTransactionsByApprovees() {
|
public void shouldFindTransactionsByApprovees() {
|
||||||
FindTransactionResponse trans = proxy.findTransactionsByApprovees(TEST_HASH);
|
FindTransactionResponse trans = proxy.findTransactionsByApprovees(TEST_HASH);
|
||||||
assertThat(trans.getHashes(), IsNull.notNullValue());
|
assertThat(trans.getHashes(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldFindTransactionsByBundles() {
|
public void shouldFindTransactionsByBundles() {
|
||||||
FindTransactionResponse trans = proxy.findTransactionsByBundles(TEST_HASH);
|
FindTransactionResponse trans = proxy.findTransactionsByBundles(TEST_HASH);
|
||||||
assertThat(trans.getHashes(), IsNull.notNullValue());
|
assertThat(trans.getHashes(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldFindTransactionsByDigests() {
|
public void shouldFindTransactionsByDigests() {
|
||||||
FindTransactionResponse trans = proxy.findTransactionsByDigests(TEST_HASH);
|
FindTransactionResponse trans = proxy.findTransactionsByDigests(TEST_HASH);
|
||||||
assertThat(trans.getHashes(), IsNull.notNullValue());
|
assertThat(trans.getHashes(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetTrytes() throws ArgumentException {
|
public void shouldGetTrytes() throws ArgumentException {
|
||||||
GetTrytesResponse res = proxy.getTrytes(TEST_HASH);
|
GetTrytesResponse res = proxy.getTrytes(TEST_HASH);
|
||||||
assertThat(res.getTrytes(), IsNull.notNullValue());
|
assertThat(res.getTrytes(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldNotGetInclusionStates() throws ArgumentException {
|
public void shouldNotGetInclusionStates() throws ArgumentException {
|
||||||
proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{"ZIJGAJ9AADLRPWNCYNNHUHRRAC9QOUDATEDQUMTNOTABUVRPTSTFQDGZKFYUUIE9ZEBIVCCXXXLKX9999"});
|
proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{"ZIJGAJ9AADLRPWNCYNNHUHRRAC9QOUDATEDQUMTNOTABUVRPTSTFQDGZKFYUUIE9ZEBIVCCXXXLKX9999"});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetInclusionStates() throws ArgumentException {
|
public void shouldGetInclusionStates() throws ArgumentException {
|
||||||
GetInclusionStateResponse res = proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{proxy.getNodeInfo().getLatestSolidSubtangleMilestone()});
|
GetInclusionStateResponse res = proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{proxy.getNodeInfo().getLatestSolidSubtangleMilestone()});
|
||||||
assertThat(res.getStates(), IsNull.notNullValue());
|
assertThat(res.getStates(), IsNull.notNullValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // very long execution
|
@Test // very long execution
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetTransactionsToApprove() {
|
public void shouldGetTransactionsToApprove() {
|
||||||
GetTransactionsToApproveResponse res = proxy.getTransactionsToApprove(27);
|
GetTransactionsToApproveResponse res = proxy.getTransactionsToApprove(27);
|
||||||
assertThat(res.getTrunkTransaction(), IsNull.notNullValue());
|
assertThat(res.getTrunkTransaction(), IsNull.notNullValue());
|
||||||
@ -121,6 +136,7 @@ public class IotaCoreApiTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldFindTransactions() {
|
public void shouldFindTransactions() {
|
||||||
String test = TEST_BUNDLE;
|
String test = TEST_BUNDLE;
|
||||||
FindTransactionResponse resp = proxy.findTransactions(new String[]{test}, new String[]{test}, new String[]{test}, new String[]{test});
|
FindTransactionResponse resp = proxy.findTransactions(new String[]{test}, new String[]{test}, new String[]{test}, new String[]{test});
|
||||||
@ -128,6 +144,7 @@ public class IotaCoreApiTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void shouldGetBalances() throws ArgumentException {
|
public void shouldGetBalances() throws ArgumentException {
|
||||||
GetBalancesResponse res = proxy.getBalances(100, Collections.singletonList(TEST_ADDRESS_WITH_CHECKSUM));
|
GetBalancesResponse res = proxy.getBalances(100, Collections.singletonList(TEST_ADDRESS_WITH_CHECKSUM));
|
||||||
assertThat(res.getBalances(), IsNull.notNullValue());
|
assertThat(res.getBalances(), IsNull.notNullValue());
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package jota;
|
package jota;
|
||||||
|
|
||||||
|
import jota.category.IntegrationTest;
|
||||||
import jota.error.ArgumentException;
|
import jota.error.ArgumentException;
|
||||||
import jota.model.Bundle;
|
import jota.model.Bundle;
|
||||||
import jota.model.Transaction;
|
import jota.model.Transaction;
|
||||||
@ -10,6 +11,7 @@ import jota.utils.Multisig;
|
|||||||
import jota.utils.Signing;
|
import jota.utils.Signing;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -35,6 +37,7 @@ public class IotaMultisigTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Category(IntegrationTest.class)
|
||||||
public void basicMultiSigTest() throws ArgumentException {
|
public void basicMultiSigTest() throws ArgumentException {
|
||||||
Multisig ms = new Multisig();
|
Multisig ms = new Multisig();
|
||||||
|
|
||||||
|
|||||||
4
jota/src/test/java/jota/category/IntegrationTest.java
Normal file
4
jota/src/test/java/jota/category/IntegrationTest.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package jota.category;
|
||||||
|
|
||||||
|
public interface IntegrationTest {
|
||||||
|
}
|
||||||
4
jota/src/test/java/jota/category/UnitTest.java
Normal file
4
jota/src/test/java/jota/category/UnitTest.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package jota.category;
|
||||||
|
|
||||||
|
public interface UnitTest {
|
||||||
|
}
|
||||||
17
pom.xml
17
pom.xml
@ -51,12 +51,12 @@
|
|||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<skipTests>true</skipTests>
|
|
||||||
|
|
||||||
<!-- plugins -->
|
<!-- plugins -->
|
||||||
<version.maven-release-plugin>2.5.3</version.maven-release-plugin>
|
<version.maven-release-plugin>2.5.3</version.maven-release-plugin>
|
||||||
<version.maven-source-plugin>3.0.1</version.maven-source-plugin>
|
<version.maven-source-plugin>3.0.1</version.maven-source-plugin>
|
||||||
<version.maven-javadoc-plugin>2.10.4</version.maven-javadoc-plugin>
|
<version.maven-javadoc-plugin>2.10.4</version.maven-javadoc-plugin>
|
||||||
|
<version.maven-surefire-plugin>2.13</version.maven-surefire-plugin>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@ -128,6 +128,21 @@
|
|||||||
<tagNameFormat>@{project.version}</tagNameFormat>
|
<tagNameFormat>@{project.version}</tagNameFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${version.maven-surefire-plugin}</version>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.surefire</groupId>
|
||||||
|
<artifactId>surefire-junit47</artifactId>
|
||||||
|
<version>${version.maven-surefire-plugin}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<configuration>
|
||||||
|
<excludedGroups>jota.category.IntegrationTest</excludedGroups>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user