ThingDefinitionCreated extends AbstractThingEvent<ThingDefinitionCreated> implements ThingModifiedEvent<ThingDefinitionCreated> { @Deprecated public static ThingDefinitionCreated of(final ThingId thingId, final ThingDefinition definition, final long revision, final DittoHeaders dittoHeaders) { return of(thingId, definition, revision, null, dittoHeaders, null); } private  ThingDefinitionCreated(final ThingId thingId,
            final ThingDefinition definition,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); @Deprecated static ThingDefinitionCreated of(final ThingId thingId,
            final ThingDefinition definition,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static ThingDefinitionCreated of(final ThingId thingId,
            final ThingDefinition definition,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static ThingDefinitionCreated of(final ThingId thingId,
            final ThingDefinition definition,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); static ThingDefinitionCreated fromJson(final String jsonString, final DittoHeaders dittoHeaders); static ThingDefinitionCreated fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); ThingDefinition getThingDefinition(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override ThingDefinitionCreated setRevision(final long revision); @Override ThingDefinitionCreated setDittoHeaders(final DittoHeaders dittoHeaders); @Override int hashCode(); @SuppressWarnings("squid:MethodCyclomaticComplexity") @Override boolean equals(@Nullable final Object o); @Override String toString(); static final String NAME; static final String TYPE; }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullThingId() { ThingDefinitionCreated.of((ThingId) null, TestConstants.Thing.DEFINITION, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final ThingDefinitionCreated underTest = ThingDefinitionCreated.of(TestConstants.Thing.THING_ID, TestConstants.Thing.DEFINITION, TestConstants.Thing.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.EMPTY_DITTO_HEADERS, TestConstants.METADATA); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }