VotePayloadConverter implements PayloadConverter<Vote> { @Override public BytesValue convertToPayload(final Vote vote) { logger.debug("Convert to payload from {}", vote); final Map<String, Object> map = new HashMap<>(); map.put("Name", vote.getOperationName()); map.put("Args", vote.getCandidates()); return mapper.marshal(map); }  @Override BytesValue convertToPayload(final Vote vote); @Override Vote parseToModel(final BytesValue payload);  }
@Test public void testConvertToPayload() { final PayloadConverter<Vote> converter = new VotePayloadConverter(); final Vote vote = Vote.newBuilder() .voteId(randomUUID().toString()) .candidates(Arrays.asList(new String[] {randomUUID().toString(), randomUUID().toString()})) .build(); final BytesValue payload = converter.convertToPayload(vote); assertNotNull(payload); }