### Question:
AbstractEvent implements Event { @Override public final String serialize() { try { return MAPPER.writeValueAsString(this); } catch (final Exception e) { throw new IllegalStateException("Could not serialize event: [" + this + "]", e); } }  @Override abstract String type(); static T newEvent(final Class<T> eventClass, final String serializedEvent); @Override final String serialize();  }### Answer:
@Test public void shouldSerializeEvent_withOnlyType() { final String type = Randoms.randomString(10); final String value = Randoms.randomString(10); final String expectedSerializedEvent = "{\"value\":\"" + value + "\"}"; final AbstractEvent event = new AbstractEvent() { @Override public String type() { return type; } @SuppressWarnings("unused") public String getValue() { return value; } }; final String serializedEvent = event.serialize(); Assert.assertEquals(expectedSerializedEvent, serializedEvent); }