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
commit d8f9c9f39a
2 changed files with 8 additions and 2 deletions

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);
}
}
/**

View File

@ -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);
}
}