Merge pull request #28 from jpkrohling/JPK-TransferShouldNotRequireTag

Fixes #23 - Transfer should not require a tag
This commit is contained in:
Oliver Nitzschke
2017-08-15 11:57:55 +02:00
committed by GitHub
2 changed files with 8 additions and 2 deletions
+6 -2
View File
@@ -144,8 +144,12 @@ public class InputValidator {
return false;
}
// Check if tag is correct trytes of {0,27} trytes
return isTrytes(transfer.getTag(), 27);
if (null == transfer.getTag() || transfer.getTag().isEmpty()) {
return true;
} else {
// Check if tag is correct trytes of {0,27} trytes
return isTrytes(transfer.getTag(), 27);
}
}
/**
@@ -52,6 +52,8 @@ public class InputValidatorTest {
List<Transfer> transfers = new ArrayList<>();
transfers.add(new jota.model.Transfer(TEST_ADDRESS_WITH_CHECKSUM, 0, TEST_MESSAGE, TEST_TAG));
transfers.add(new jota.model.Transfer(TEST_ADDRESS_WITH_CHECKSUM, 0, TEST_MESSAGE, TEST_TAG));
transfers.add(new jota.model.Transfer(TEST_ADDRESS_WITH_CHECKSUM, 0, TEST_MESSAGE, null));
transfers.add(new jota.model.Transfer(TEST_ADDRESS_WITH_CHECKSUM, 0, TEST_MESSAGE, ""));
assertEquals(InputValidator.isTransfersCollectionValid(transfers), true);
}
}