Search in sources :

Example 91 with Address

use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.

the class MapperUtilsTest method shouldMapToAddress.

@Test
void shouldMapToAddress() {
    Assertions.assertNull(MapperUtils.toAddressFromRawAddress(null));
    Address address = MapperUtils.toAddressFromRawAddress("TDGRZDZEHD4M5K3JIT64DU3PEKFYNF5VWFEYDQA");
    Assertions.assertNotNull(address);
    Assertions.assertEquals("TDGRZDZEHD4M5K3JIT64DU3PEKFYNF5VWFEYDQA", address.plain());
    Assertions.assertEquals("TDGRZD-ZEHD4M-5K3JIT-64DU3P-EKFYNF-5VWFEY-DQA", address.pretty());
}
Also used : UnresolvedAddress(io.nem.symbol.sdk.model.account.UnresolvedAddress) Address(io.nem.symbol.sdk.model.account.Address) Test(org.junit.jupiter.api.Test)

Example 92 with Address

use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.

the class MapperUtilsTest method toAddressFromEncoded.

@Test
void toAddressFromEncoded() {
    Assertions.assertNull(MapperUtils.toAddress(null));
    Address address = MapperUtils.toAddress("9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E1");
    Assertions.assertNotNull(address);
    Assertions.assertEquals("SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYI", address.plain());
    Assertions.assertEquals("SBILTA-367K2L-X2FEXG-5TFWAS-7GEFYA-GY7QLF-BYI", address.pretty());
    Assertions.assertEquals("9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E1", address.encoded());
}
Also used : UnresolvedAddress(io.nem.symbol.sdk.model.account.UnresolvedAddress) Address(io.nem.symbol.sdk.model.account.Address) Test(org.junit.jupiter.api.Test)

Example 93 with Address

use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.

the class MetadataSearchCriteriaTest method shouldBeEquals.

@Test
void shouldBeEquals() {
    Address sourceAddress = Address.generateRandom(NetworkType.MIJIN_TEST);
    Address targetAddress = Address.generateRandom(NetworkType.MIJIN_TEST);
    MosaicId mosaicId = MosaicId.createFromNonce(MosaicNonce.createRandom(), sourceAddress);
    MetadataSearchCriteria criteria1 = new MetadataSearchCriteria().order(OrderBy.DESC).pageSize(10).pageNumber(5).offset("abc").metadataType(MetadataType.MOSAIC).scopedMetadataKey(BigInteger.ONE).sourceAddress(sourceAddress).targetAddress(targetAddress).targetId(mosaicId);
    MetadataSearchCriteria criteria2 = new MetadataSearchCriteria().order(OrderBy.DESC).pageSize(10).pageNumber(5).offset("abc").metadataType(MetadataType.MOSAIC).scopedMetadataKey(BigInteger.ONE).sourceAddress(sourceAddress).targetAddress(targetAddress).targetId(mosaicId);
    Assertions.assertEquals(criteria1, criteria1);
    Assertions.assertEquals(criteria1, criteria2);
    Assertions.assertEquals(criteria1.hashCode(), criteria2.hashCode());
    criteria2.targetId(NamespaceId.createFromName("somealias"));
    Assertions.assertEquals(criteria1, criteria1);
    Assertions.assertNotEquals(criteria1, criteria2);
    Assertions.assertNotEquals(criteria1.hashCode(), criteria2.hashCode());
}
Also used : Address(io.nem.symbol.sdk.model.account.Address) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) Test(org.junit.jupiter.api.Test)

Example 94 with Address

use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.

the class MosaicRestrictionSearchCriteriaTest method shouldSetValues.

@Test
void shouldSetValues() {
    Address address = Address.generateRandom(NetworkType.TEST_NET);
    MosaicRestrictionEntryType entryType = MosaicRestrictionEntryType.GLOBAL;
    MosaicId mosaicId = MosaicId.createFromNonce(MosaicNonce.createRandom(), address);
    MosaicRestrictionSearchCriteria criteria = new MosaicRestrictionSearchCriteria();
    criteria.setOrder(OrderBy.DESC);
    criteria.setPageSize(10);
    criteria.setPageNumber(5);
    criteria.setOffset("abc");
    criteria.setMosaicId(mosaicId);
    criteria.setTargetAddress(address);
    criteria.setEntryType(entryType);
    Assertions.assertEquals(OrderBy.DESC, criteria.getOrder());
    Assertions.assertEquals(10, criteria.getPageSize());
    Assertions.assertEquals(5, criteria.getPageNumber());
    Assertions.assertEquals("abc", criteria.getOffset());
    Assertions.assertEquals(mosaicId, criteria.getMosaicId());
    Assertions.assertEquals(address, criteria.getTargetAddress());
    Assertions.assertEquals(entryType, criteria.getEntryType());
}
Also used : MosaicRestrictionEntryType(io.nem.symbol.sdk.model.restriction.MosaicRestrictionEntryType) Address(io.nem.symbol.sdk.model.account.Address) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) Test(org.junit.jupiter.api.Test)

Example 95 with Address

use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.

the class MosaicRestrictionSearchCriteriaTest method shouldBeEquals.

@Test
void shouldBeEquals() {
    Address address = Address.generateRandom(NetworkType.TEST_NET);
    MosaicRestrictionEntryType entryType = MosaicRestrictionEntryType.GLOBAL;
    MosaicId mosaicId = MosaicId.createFromNonce(MosaicNonce.createRandom(), address);
    MosaicRestrictionSearchCriteria criteria1 = new MosaicRestrictionSearchCriteria();
    criteria1.order(OrderBy.DESC);
    criteria1.pageSize(10);
    criteria1.pageNumber(5);
    criteria1.offset("abc");
    criteria1.mosaicId(mosaicId);
    criteria1.targetAddress(address);
    criteria1.entryType(entryType);
    MosaicRestrictionSearchCriteria criteria2 = new MosaicRestrictionSearchCriteria();
    criteria2.setOrder(OrderBy.DESC);
    criteria2.setPageSize(10);
    criteria2.setPageNumber(5);
    criteria2.setOffset("abc");
    criteria2.setMosaicId(mosaicId);
    criteria2.setTargetAddress(address);
    criteria2.setEntryType(entryType);
    Assertions.assertEquals(new MosaicRestrictionSearchCriteria(), new MosaicRestrictionSearchCriteria());
    Assertions.assertEquals(criteria1, criteria2);
    Assertions.assertEquals(criteria1, criteria1);
    Assertions.assertEquals(criteria1.hashCode(), criteria2.hashCode());
    criteria1.pageNumber(30);
    Assertions.assertNotEquals(criteria1, criteria2);
    Assertions.assertNotEquals(criteria1.hashCode(), criteria2.hashCode());
    criteria2.pageNumber(100);
    Assertions.assertNotEquals(criteria1, criteria2);
    Assertions.assertNotEquals(criteria1.hashCode(), criteria2.hashCode());
    Assertions.assertNotEquals("ABC", criteria2);
    Assertions.assertNotEquals(criteria2, "ABC");
}
Also used : MosaicRestrictionEntryType(io.nem.symbol.sdk.model.restriction.MosaicRestrictionEntryType) Address(io.nem.symbol.sdk.model.account.Address) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) Test(org.junit.jupiter.api.Test)

Aggregations

Address (io.nem.symbol.sdk.model.account.Address)172 Test (org.junit.jupiter.api.Test)124 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)53 BigInteger (java.math.BigInteger)36 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)34 ArrayList (java.util.ArrayList)28 PlainMessage (io.nem.symbol.sdk.model.message.PlainMessage)27 EnumSource (org.junit.jupiter.params.provider.EnumSource)26 Account (io.nem.symbol.sdk.model.account.Account)20 PublicAccount (io.nem.symbol.sdk.model.account.PublicAccount)19 UnresolvedAddress (io.nem.symbol.sdk.model.account.UnresolvedAddress)19 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)16 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)16 ListenerSubscribeMessage (io.nem.symbol.sdk.infrastructure.ListenerSubscribeMessage)15 Mosaic (io.nem.symbol.sdk.model.mosaic.Mosaic)14 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)13 CosignatureSignedTransaction (io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction)13 Observable (io.reactivex.Observable)13 NamespaceId (io.nem.symbol.sdk.model.namespace.NamespaceId)12 SignedTransaction (io.nem.symbol.sdk.model.transaction.SignedTransaction)10