### Question:
Event { public MessageEvent ofMessage() { return (MessageEvent) this; } protected  Event( EventType type, String id, ZonedDateTime timestamp, String subscriptionId, ChannelType channel ); MessageEvent ofMessage(); MessageStatusEvent ofMessageStatus(); final EventType type; final String id; @JsonDeserialize( using = ZonedDateTimeDeserializer.class )
	@JsonSerialize( using = ZonedDateTimeSerializer.class )
	@JsonFormat( pattern = "yyyy-MM-dd'T'HH:mm:ss[.SSS]XXX" )
	final ZonedDateTime timestamp; final String subscriptionId; final ChannelType channel; }### Answer:
@Test public void messageEventDeserialization() throws IOException { Event event = jsonMapper.readValue( "{\"id\":\"some-event-id\",\"timestamp\":\"2019-06-03T15:50:43-03:00\",\"type\":\"MESSAGE\",\"subscriptionId\":\"some-subs-id\",\"channel\":\"whatsapp\",\"direction\":\"IN\",\"message\":{\"from\":\"some-from\",\"to\":\"some-to\",\"direction\":\"IN\",\"channel\":\"whatsapp\",\"contents\":[{\"type\":\"text\",\"text\":\"This is a test!\"}]}}".getBytes( StandardCharsets.UTF_8 ), Event.class ); assertNotNull( event ); assertEquals( EventType.MESSAGE, event.type ); assertEquals( "some-event-id", event.id ); assertEquals( "some-subs-id", event.subscriptionId ); assertEquals( ChannelType.whatsapp, event.channel ); assertEquals( MessageEvent.class, event.getClass() ); MessageEvent messageEvent = event.ofMessage(); assertEquals( MessageDirection.IN, messageEvent.direction ); assertEquals( "some-from", messageEvent.message.from ); assertEquals( "some-to", messageEvent.message.to ); assertEquals( ChannelType.whatsapp, messageEvent.message.channel ); assertEquals( 1, messageEvent.message.contents.size() ); TextContent textContent = messageEvent.message.contents.get(0).ofText(); assertEquals( "This is a test!", textContent.text ); }