ContractDefinition implements Payload { public static ContractDefinitionWithNothing newBuilder() { return new ContractDefinition.Builder(); } ContractDefinition(final String encodedContract, final List<Object> args,
      final Aer amount); static ContractDefinitionWithNothing newBuilder(); static final byte PAYLOAD_VERSION; }
@Test public void testBuilder() { final Object[] args = new Object[]{1, 2, 3}; final ContractDefinition expected = new ContractDefinition(payload, asList(args), Aer.ONE); final ContractDefinition actual = ContractDefinition.newBuilder() .encodedContract(payload) .constructorArgs(args) .amount(Aer.ONE) .build(); assertEquals(expected, actual); }
@Test public void testBuilderWithListArgs() { final List<Object> args = asList(new Object[]{1, 2, 3}); final ContractDefinition expected = new ContractDefinition(payload, args, Aer.ONE); final ContractDefinition actual = ContractDefinition.newBuilder() .encodedContract(payload) .constructorArgs(args) .amount(Aer.ONE) .build(); assertEquals(expected, actual); }
@Test public void shouldThrowExceptionOnPayloadWithoutVersion() { try { final String withoutVersion = Base58Utils.encodeWithCheck(new byte[]{(byte) 0xAA}); ContractDefinition.newBuilder() .encodedContract(withoutVersion) .amount(Aer.ONE) .build(); fail(); } catch (HerajException e) { } }