use of io.nem.symbol.sdk.model.namespace.NamespaceId in project nem2-sdk-java by nemtech.
the class CurrencyTest method createMosaicWithIntegers.
@Test
void createMosaicWithIntegers() {
NamespaceId namespaceId = NamespaceId.createFromName("mycurrency");
Currency currency = new CurrencyBuilder(namespaceId, 3).withSupplyMutable(false).withTransferable(true).build();
Mosaic mosaic1 = currency.createRelative(15);
Mosaic mosaic2 = currency.createRelative(BigInteger.valueOf(15));
Mosaic mosaic3 = currency.createAbsolute(15000);
Assertions.assertEquals(mosaic1, mosaic2);
Assertions.assertEquals(mosaic1, mosaic3);
}
use of io.nem.symbol.sdk.model.namespace.NamespaceId in project nem2-sdk-java by nemtech.
the class CurrencyTest method assertCreatedUsingNamespaceIdAndSettingMosaicId.
@Test
void assertCreatedUsingNamespaceIdAndSettingMosaicId() {
MosaicId mosaicId = new MosaicId(BigInteger.TEN);
NamespaceId namespaceId = NamespaceId.createFromName("mycurrency");
Currency currency = new CurrencyBuilder(namespaceId, 6).withSupplyMutable(false).withTransferable(true).withMosaicId(mosaicId).build();
Assertions.assertEquals(namespaceId, currency.getNamespaceId().get());
Assertions.assertEquals(namespaceId, currency.getUnresolvedMosaicId());
assertEquals(mosaicId, currency.getMosaicId().get());
}
use of io.nem.symbol.sdk.model.namespace.NamespaceId in project nem2-sdk-java by nemtech.
the class NetworkHarvestCatHarvestTest method shouldCompareNamespaceIdsForEquality.
@Test
void shouldCompareNamespaceIdsForEquality() {
NamespaceId namespaceId = NamespaceId.createFromId(BigInteger.valueOf(-7776984613647210212L));
assertEquals(-7776984613647210212L, namespaceId.getIdAsLong());
assertEquals(currency.getNamespaceId().get().getIdAsLong(), namespaceId.getIdAsLong());
assertEquals(currency.getNamespaceId().get().getIdAsHex(), namespaceId.getIdAsHex());
}
use of io.nem.symbol.sdk.model.namespace.NamespaceId in project nem2-sdk-java by nemtech.
the class CurrencyCatCurrencyTest method shouldCompareNamespaceIdsForEquality.
@Test
void shouldCompareNamespaceIdsForEquality() {
NamespaceId namespaceId = NamespaceId.createFromId(BigInteger.valueOf(-8810190493148073404L));
assertEquals(-8810190493148073404L, namespaceId.getIdAsLong());
assertEquals(currency.getNamespaceId().get().getIdAsLong(), namespaceId.getIdAsLong());
assertEquals(currency.getNamespaceId().get().getIdAsHex(), namespaceId.getIdAsHex());
// Note:
// BigInteger decimal generated from namespace path vs generated using Lower and
// Higher
// integers
// Using namespace path: 9636553580561478212 (Decimal number)
// Using Lower and Higher: -8810190493148073404 (Decimal from signed 2's
// complement)
// In Hexadecimal: 85bbea6cc462b244 (same for both)
}
use of io.nem.symbol.sdk.model.namespace.NamespaceId in project nem2-sdk-java by nemtech.
the class CurrencySymbolXymTest method shouldCompareNamespaceIdsForEquality.
@Test
void shouldCompareNamespaceIdsForEquality() {
NamespaceId namespaceId = NamespaceId.createFromId(BigInteger.valueOf(-1780160202445377554L));
assertEquals(-1780160202445377554L, namespaceId.getIdAsLong());
assertEquals(currency.getNamespaceId().get().getIdAsLong(), namespaceId.getIdAsLong());
assertEquals(currency.getNamespaceId().get().getIdAsHex(), namespaceId.getIdAsHex());
// Note:
// BigInteger decimal generated from namespace path vs generated using Lower and
// Higher
// integers
// Using namespace path: 9636553580561478212 (Decimal number)
// Using Lower and Higher: -8810190493148073404 (Decimal from signed 2's
// complement)
// In Hexadecimal: 85bbea6cc462b244 (same for both)
}
Aggregations