Price implements ByteTransformable { @Override public byte[] toByteArray() throws SteemInvalidTransactionException { try (ByteArrayOutputStream serializedPriceObject = new ByteArrayOutputStream()) { serializedPriceObject.write(this.getBase().toByteArray()); serializedPriceObject.write(this.getQuote().toByteArray()); return serializedPriceObject.toByteArray(); } catch (IOException e) { throw new SteemInvalidTransactionException( "A problem occured while transforming the object into a byte array.", e); } } @JsonCreator  Price(@JsonProperty("base") LegacyAsset base, @JsonProperty("quote") LegacyAsset quote); LegacyAsset getBase(); void setBase(LegacyAsset base); LegacyAsset getQuote(); void setQuote(LegacyAsset quote); LegacyAsset multiply(LegacyAsset asset); @Override byte[] toByteArray(); @Override String toString(); @Override boolean equals(Object otherObject); @Override int hashCode();  }
@Test public void testPriceToByteArray() throws Exception { LegacyAsset base = new LegacyAsset(115, LegacyAssetSymbolType.SBD); LegacyAsset quote = new LegacyAsset(100, LegacyAssetSymbolType.STEEM); Price price = new Price(base, quote); assertThat("Expect that the price object has the given byte representation.", CryptoUtils.HEX.encode(price.toByteArray()), equalTo(EXPECTED_BYTE_REPRESENTATION)); }