updated tests

This commit is contained in:
pinpong
2017-11-12 16:47:55 +01:00
parent 4304c53d44
commit fbacc5ae44
2 changed files with 23 additions and 18 deletions
+22 -16
View File
@@ -151,25 +151,33 @@ public class IotaAPITest {
assertEquals(res.getAddresses().size(), 100);
}
@Test
//seed contains 0 balance
@Test(expected = IllegalStateException.class)
public void shouldPrepareTransfer() throws ArgumentException {
List<Transfer> transfers = new ArrayList<>();
transfers.add(new Transfer(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_2, 100, TEST_MESSAGE, TEST_TAG));
List<String> trytes = iotaAPI.prepareTransfers(TEST_SEED1, 2, transfers, null, null, false);
Assert.assertNotNull(trytes);
assertThat(trytes.isEmpty(), Is.is(false));
}
//seed contains 0 balance
@Test(expected = IllegalStateException.class)
public void shouldPrepareTransferWithInputs() throws ArgumentException {
List<Input> inputlist = new ArrayList<>();
List<Transfer> transfers = new ArrayList<>();
GetBalancesAndFormatResponse rsp = iotaAPI.getInputs(TEST_SEED1, 2, 0, 0, 100);
GetBalancesAndFormatResponse rsp = iotaAPI.getInputs(TEST_SEED1, 2, 0, 0, 0);
for (Input input : rsp.getInputs()) {
inputlist.add(input);
}
transfers.add(new Transfer(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_2, 0, TEST_MESSAGE, TEST_TAG));
transfers.add(new Transfer(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_2, 0));
List<String> trytes1 = iotaAPI.prepareTransfers(TEST_SEED1, 2, transfers, null, null, false);
List<String> trytes2 = iotaAPI.prepareTransfers(TEST_SEED1, 2, transfers, null, inputlist, true);
inputlist.addAll(rsp.getInputs());
Assert.assertNotNull(trytes1);
assertThat(trytes1.isEmpty(), Is.is(false));
Assert.assertNotNull(trytes2);
assertThat(trytes2.isEmpty(), Is.is(false));
transfers.add(new Transfer(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_2, 100, TEST_MESSAGE, TEST_TAG));
List<String> trytes = iotaAPI.prepareTransfers(TEST_SEED1, 2, transfers, null, inputlist, true);
Assert.assertNotNull(trytes);
assertThat(trytes.isEmpty(), Is.is(false));
}
@Test
@@ -274,9 +282,7 @@ public class IotaAPITest {
GetBalancesAndFormatResponse rsp = iotaAPI.getInputs(TEST_SEED1, 2, 0, 0, 1);
for (Input input : rsp.getInputs()) {
inputlist.add(input);
}
inputlist.addAll(rsp.getInputs());
transfers.add(new Transfer(TEST_ADDRESS_WITHOUT_CHECKSUM_SECURITY_LEVEL_2, 1, TEST_MESSAGE, TEST_TAG));
+1 -2
View File
@@ -100,10 +100,9 @@ public class IotaCoreApiTest {
public void shouldGetTrytes() throws ArgumentException {
GetTrytesResponse res = proxy.getTrytes(TEST_HASH);
assertThat(res.getTrytes(), IsNull.notNullValue());
}
@Test(expected = ArgumentException.class)
@Test
public void shouldNotGetInclusionStates() throws ArgumentException {
proxy.getInclusionStates(new String[]{TEST_HASH}, new String[]{"ZIJGAJ9AADLRPWNCYNNHUHRRAC9QOUDATEDQUMTNOTABUVRPTSTFQDGZKFYUUIE9ZEBIVCCXXXLKX9999"});
}