### Question:
JsonShareSerialiser implements ShareSerialiser { @Override @Nonnull public Single<String> serialise(@Nonnull final Share share) { checkNotNull(share, "\'share\' must not be null."); return Single.fromCallable(() -> { final String indexBase64Encoded = Base64.getEncoder().encodeToString(share.getIndex().toByteArray()); final String valueBase64Encoded = Base64.getEncoder().encodeToString(share.getValue().toByteArray()); final JsonObject json = new JsonObject(); json.addProperty("index", indexBase64Encoded); json.addProperty("value", valueBase64Encoded); return json.toString(); }); }  @Override @Nonnull Single<String> serialise(@Nonnull final Share share); @Override @Nonnull Single<Share> deserialise(@Nonnull final String serialisedShare); @Override @Nonnull Single<Boolean> isValidSerialisation(@Nonnull final String serialisedShare);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testSerialise_nullShare() { serialiser.serialise(null); }
@Test public void testSerialiseAndDeserialise() { final Share share = Share .builder() .setIndex(1) .setValue(2) .build(); serialiser .serialise(share) .flatMap(serialiser::deserialise) .test() .awaitDone(200, MILLISECONDS) .assertNoErrors() .assertValue(share); }
@Test public void testIsValidSerialisation_wellFormedInput() { final Share share = Share .builder() .setIndex(1) .setValue(2) .build(); serialiser .serialise(share) .flatMap(serialiser::isValidSerialisation) .test() .awaitDone(200, MILLISECONDS) .assertNoErrors() .assertValue(true); }