### Question:
ThingCreated extends AbstractThingEvent<ThingCreated> implements ThingModifiedEvent<ThingCreated> { @Deprecated public static ThingCreated of(final Thing thing, final long revision, final DittoHeaders dittoHeaders) { return of(thing, revision, null, dittoHeaders, null); } private  ThingCreated(final Thing thing,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); @Deprecated static ThingCreated of(final Thing thing,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static ThingCreated of(final Thing thing,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static ThingCreated of(final Thing thing,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); static ThingCreated fromJson(final String jsonString, final DittoHeaders dittoHeaders); static ThingCreated fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); Thing getThing(); @Override ThingCreated setRevision(final long revision); @Override ThingCreated setDittoHeaders(final DittoHeaders dittoHeaders); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @SuppressWarnings("squid:S109") @Override int hashCode(); @SuppressWarnings("squid:MethodCyclomaticComplexity") @Override boolean equals(@Nullable final Object o); @Override String toString(); static final String NAME; static final String TYPE; }### Answer:
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullThing() { ThingCreated.of(null, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final ThingCreated underTest = ThingCreated.of(TestConstants.Thing.THING, TestConstants.Thing.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.EMPTY_DITTO_HEADERS, TestConstants.METADATA); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }
@Test public void parseThingCreatedEvent() { final GlobalEventRegistry eventRegistry = GlobalEventRegistry.getInstance(); final ThingCreated event = ThingCreated.of(TestConstants.Thing.THING, TestConstants.Thing.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.DITTO_HEADERS, TestConstants.METADATA); final JsonObject jsonObject = event.toJson(FieldType.regularOrSpecial()); final Event parsedEvent = eventRegistry.parse(jsonObject, TestConstants.DITTO_HEADERS); assertThat(parsedEvent).isEqualTo(event); }