RemoteDataPayload { @NonNull static RemoteDataPayload parsePayload(@NonNull JsonValue value, @NonNull JsonMap metadata) throws JsonException { JsonMap map = value.optMap(); JsonValue type = map.opt("type"); JsonValue isoTimestamp = map.opt("timestamp"); JsonValue data = map.opt("data"); try { if (type.isString() && isoTimestamp.isString() && data.isJsonMap()) { long timestampMs = DateUtils.parseIso8601(isoTimestamp.getString()); return RemoteDataPayload.newBuilder() .setData(data.optMap()) .setTimeStamp(timestampMs) .setType(type.optString()) .setMetadata(metadata) .build(); } else { throw new JsonException("Invalid remote data payload: " + value.toString()); } } catch (IllegalArgumentException | ParseException e) { throw new JsonException("Invalid remote data payload: " + value.toString(), e); } } private  RemoteDataPayload(@NonNull Builder builder); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override @NonNull String toString(); @NonNull final String getType(); final long getTimestamp(); @NonNull final JsonMap getData(); @NonNull final JsonMap getMetadata(); @NonNull static Builder newBuilder(); @NonNull
    static final String METADATA_LANGUAGE; @NonNull
    static final String METADATA_COUNTRY; @NonNull
    static final String METADATA_SDK_VERSION; }
@Test public void testParsePayload() throws Exception { RemoteDataPayload parsedPayload = RemoteDataPayload.parsePayload(payload, metadata); verifyPayload(parsedPayload); }