Search in sources :

Example 6 with DisplayName

use of org.junit.jupiter.api.DisplayName in project nem2-sdk-java by nemtech.

the class RegisterNamespaceTransactionTest method serializationSubNamespace.

@Test
@DisplayName("Serialization sub namespace")
void serializationSubNamespace() {
    // Generated at nem2-library-js/test/transactions/RegisterNamespaceTransaction.spec.js
    byte[] expected = new byte[] { (byte) 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, (byte) 144, 78, 65, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 126, (byte) 233, (byte) 179, (byte) 184, (byte) 175, (byte) 223, 83, 64, 3, 18, (byte) 152, 27, 120, 121, (byte) 163, 113, 12, 115, 117, 98, 110, 97, 109, 101, 115, 112, 97, 99, 101 };
    RegisterNamespaceTransaction registerNamespaceTransaction = RegisterNamespaceTransaction.createSubNamespace(new FakeDeadline(), "subnamespace", new NamespaceId(new BigInteger("4635294387305441662")), NetworkType.MIJIN_TEST);
    byte[] actual = registerNamespaceTransaction.generateBytes();
    assertArrayEquals(expected, actual);
}
Also used : BigInteger(java.math.BigInteger) NamespaceId(io.nem.sdk.model.namespace.NamespaceId) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 7 with DisplayName

use of org.junit.jupiter.api.DisplayName in project nem2-sdk-java by nemtech.

the class TransferTransactionTest method serialization.

@Test
@DisplayName("Serialization")
void serialization() {
    // Generated at nem2-library-js/test/transactions/TransferTransaction.spec.js
    byte[] expected = new byte[] { (byte) 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, (byte) 144, 84, 65, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, (byte) 144, (byte) 232, (byte) 254, (byte) 189, (byte) 103, (byte) 29, (byte) 212, (byte) 27, (byte) 238, (byte) 148, (byte) 236, (byte) 59, (byte) 165, (byte) 131, (byte) 28, (byte) 182, (byte) 8, (byte) 163, (byte) 18, (byte) 194, (byte) 242, (byte) 3, (byte) 186, (byte) 132, (byte) 172, 1, 0, 1, 0, 103, 43, 0, 0, (byte) 206, 86, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0 };
    TransferTransaction transferTransaction = TransferTransaction.create(new FakeDeadline(), new Address("SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM", NetworkType.MIJIN_TEST), Arrays.asList(new Mosaic(new MosaicId(new BigInteger("95442763262823")), BigInteger.valueOf(100))), PlainMessage.Empty, NetworkType.MIJIN_TEST);
    byte[] actual = transferTransaction.generateBytes();
    assertArrayEquals(expected, actual);
}
Also used : Address(io.nem.sdk.model.account.Address) MosaicId(io.nem.sdk.model.mosaic.MosaicId) BigInteger(java.math.BigInteger) Mosaic(io.nem.sdk.model.mosaic.Mosaic) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 8 with DisplayName

use of org.junit.jupiter.api.DisplayName in project winery by eclipse.

the class YamlWriterTest method roundTripSingleTest.

@DisplayName("Test read and write single round trip")
@ParameterizedTest(name = "{index} name=''{0}''")
@ValueSource(strings = { "example_16-topology_templates-1_1" })
public void roundTripSingleTest(String file) throws Exception {
    Path fileName = getYamlFile(file);
    TServiceTemplate serviceTemplate = this.getYamlServiceTemplate(fileName);
    writeYamlServiceTemplate(serviceTemplate, temporaryFolder.resolve(fileName));
    TServiceTemplate out = this.getYamlServiceTemplate(fileName, temporaryFolder);
    Assertions.assertEquals(serviceTemplate, out);
}
Also used : Path(java.nio.file.Path) TServiceTemplate(org.eclipse.winery.model.tosca.yaml.TServiceTemplate) ValueSource(org.junit.jupiter.params.provider.ValueSource) DisplayName(org.junit.jupiter.api.DisplayName) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

DisplayName (org.junit.jupiter.api.DisplayName)8 Test (org.junit.jupiter.api.Test)6 BigInteger (java.math.BigInteger)4 Address (io.nem.sdk.model.account.Address)3 Mosaic (io.nem.sdk.model.mosaic.Mosaic)3 MosaicId (io.nem.sdk.model.mosaic.MosaicId)3 PublicAccount (io.nem.sdk.model.account.PublicAccount)2 TServiceTemplate (org.eclipse.winery.model.tosca.yaml.TServiceTemplate)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MosaicProperties (io.nem.sdk.model.mosaic.MosaicProperties)1 NamespaceId (io.nem.sdk.model.namespace.NamespaceId)1 Path (java.nio.file.Path)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1