Delete skipTests flag and separate unit and integration tests

This commit is contained in:
Bartosz Miller 2017-12-10 21:45:55 +01:00
parent c668a41784
commit 8e12cbb758
7 changed files with 57 additions and 2 deletions

View File

@ -16,7 +16,7 @@ before_install:
install:
# 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:
- .travis/publish.sh

View File

@ -1,6 +1,7 @@
package jota;
import com.google.gson.Gson;
import jota.category.IntegrationTest;
import jota.dto.response.*;
import jota.error.ArgumentException;
import jota.model.Bundle;
@ -13,6 +14,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.ArrayList;
import java.util.List;
@ -113,6 +115,7 @@ public class IotaAPITest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetInputs() throws ArgumentException {
GetBalancesAndFormatResponse res = iotaAPI.getInputs(TEST_SEED1, 2, 0, 0, 0);
System.out.println(res);
@ -153,6 +156,7 @@ public class IotaAPITest {
//seed contains 0 balance
@Test(expected = IllegalStateException.class)
@Category(IntegrationTest.class)
public void shouldPrepareTransfer() throws ArgumentException {
List<Transfer> transfers = new ArrayList<>();
@ -165,6 +169,7 @@ public class IotaAPITest {
//seed contains 0 balance
@Test(expected = IllegalStateException.class)
@Category(IntegrationTest.class)
public void shouldPrepareTransferWithInputs() throws ArgumentException {
List<Input> inputlist = new ArrayList<>();
List<Transfer> transfers = new ArrayList<>();
@ -181,12 +186,14 @@ public class IotaAPITest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetLastInclusionState() throws ArgumentException {
GetInclusionStateResponse res = iotaAPI.getLatestInclusion(new String[]{TEST_HASH});
assertThat(res.getStates(), IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldFindTransactionObjects() throws ArgumentException {
List<Transaction> ftr = iotaAPI.findTransactionObjectsByAddresses(TEST_ADDRESSES);
System.out.println(ftr);
@ -194,6 +201,7 @@ public class IotaAPITest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetAccountData() throws ArgumentException {
GetAccountDataResponse gad = iotaAPI.getAccountData(TEST_SEED1, 2, 0, true, 0, true, 0, 0, true, 0);
assertThat(gad, IsNull.notNullValue());
@ -206,6 +214,7 @@ public class IotaAPITest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetBundle() throws ArgumentException {
GetBundleResponse gbr = iotaAPI.getBundle(TEST_HASH);
System.out.println(gbr);
@ -213,6 +222,7 @@ public class IotaAPITest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetTransfers() throws ArgumentException {
GetTransferResponse gtr = iotaAPI.getTransfers(TEST_SEED1, 2, 0, 0, false);
assertThat(gtr.getTransfers(), IsNull.notNullValue());
@ -239,11 +249,13 @@ public class IotaAPITest {
}
@Test()
@Category(IntegrationTest.class)
public void shouldGetTrytes() throws ArgumentException {
System.out.println(iotaAPI.getTrytes(TEST_HASH));
}
@Test()
@Category(IntegrationTest.class)
public void shouldBroadcastAndStore() throws ArgumentException {
System.out.println(iotaAPI.broadcastAndStore(TEST_TRYTES));
}

View File

@ -1,11 +1,13 @@
package jota;
import com.google.gson.Gson;
import jota.category.IntegrationTest;
import jota.dto.response.*;
import jota.error.ArgumentException;
import org.hamcrest.core.IsNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.Collections;
@ -27,6 +29,7 @@ public class IotaCoreApiTest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetNodeInfo() {
GetNodeInfoResponse nodeInfo = proxy.getNodeInfo();
System.out.println(new Gson().toJson(nodeInfo));
@ -49,71 +52,83 @@ public class IotaCoreApiTest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetNeighbors() {
GetNeighborsResponse neighbors = proxy.getNeighbors();
assertThat(neighbors.getNeighbors(), IsNull.notNullValue());
}
@Test(expected = IllegalAccessError.class)
@Category(IntegrationTest.class)
public void shouldAddNeighbors() {
AddNeighborsResponse res = proxy.addNeighbors("udp://8.8.8.8:14265");
assertThat(res, IsNull.notNullValue());
}
@Test(expected = IllegalAccessError.class)
@Category(IntegrationTest.class)
public void shouldRemoveNeighbors() {
RemoveNeighborsResponse res = proxy.removeNeighbors("udp://8.8.8.8:14265");
assertThat(res, IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldGetTips() {
GetTipsResponse tips = proxy.getTips();
assertThat(tips, IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldFindTransactionsByAddresses() throws ArgumentException {
FindTransactionResponse trans = proxy.findTransactionsByAddresses(TEST_ADDRESS_WITH_CHECKSUM);
assertThat(trans.getHashes(), IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldFindTransactionsByApprovees() {
FindTransactionResponse trans = proxy.findTransactionsByApprovees(TEST_HASH);
assertThat(trans.getHashes(), IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldFindTransactionsByBundles() {
FindTransactionResponse trans = proxy.findTransactionsByBundles(TEST_HASH);
assertThat(trans.getHashes(), IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldFindTransactionsByDigests() {
FindTransactionResponse trans = proxy.findTransactionsByDigests(TEST_HASH);
assertThat(trans.getHashes(), IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldGetTrytes() throws ArgumentException {
GetTrytesResponse res = proxy.getTrytes(TEST_HASH);
assertThat(res.getTrytes(), IsNull.notNullValue());
}
@Test
@Category(IntegrationTest.class)
public void shouldNotGetInclusionStates() throws ArgumentException {
proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{"ZIJGAJ9AADLRPWNCYNNHUHRRAC9QOUDATEDQUMTNOTABUVRPTSTFQDGZKFYUUIE9ZEBIVCCXXXLKX9999"});
}
@Test
@Category(IntegrationTest.class)
public void shouldGetInclusionStates() throws ArgumentException {
GetInclusionStateResponse res = proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{proxy.getNodeInfo().getLatestSolidSubtangleMilestone()});
assertThat(res.getStates(), IsNull.notNullValue());
}
@Test // very long execution
@Category(IntegrationTest.class)
public void shouldGetTransactionsToApprove() {
GetTransactionsToApproveResponse res = proxy.getTransactionsToApprove(27);
assertThat(res.getTrunkTransaction(), IsNull.notNullValue());
@ -121,6 +136,7 @@ public class IotaCoreApiTest {
}
@Test
@Category(IntegrationTest.class)
public void shouldFindTransactions() {
String test = TEST_BUNDLE;
FindTransactionResponse resp = proxy.findTransactions(new String[]{test}, new String[]{test}, new String[]{test}, new String[]{test});
@ -128,6 +144,7 @@ public class IotaCoreApiTest {
}
@Test
@Category(IntegrationTest.class)
public void shouldGetBalances() throws ArgumentException {
GetBalancesResponse res = proxy.getBalances(100, Collections.singletonList(TEST_ADDRESS_WITH_CHECKSUM));
assertThat(res.getBalances(), IsNull.notNullValue());

View File

@ -1,5 +1,6 @@
package jota;
import jota.category.IntegrationTest;
import jota.error.ArgumentException;
import jota.model.Bundle;
import jota.model.Transaction;
@ -10,6 +11,7 @@ import jota.utils.Multisig;
import jota.utils.Signing;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.ArrayList;
import java.util.List;
@ -35,6 +37,7 @@ public class IotaMultisigTest {
}
@Test
@Category(IntegrationTest.class)
public void basicMultiSigTest() throws ArgumentException {
Multisig ms = new Multisig();

View File

@ -0,0 +1,4 @@
package jota.category;
public interface IntegrationTest {
}

View File

@ -0,0 +1,4 @@
package jota.category;
public interface UnitTest {
}

17
pom.xml
View File

@ -51,12 +51,12 @@
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<!-- plugins -->
<version.maven-release-plugin>2.5.3</version.maven-release-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-surefire-plugin>2.13</version.maven-surefire-plugin>
</properties>
<modules>
@ -128,6 +128,21 @@
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</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>
</build>