AttributesCreated extends AbstractThingEvent<AttributesCreated> implements ThingModifiedEvent<AttributesCreated> { @Deprecated public static AttributesCreated of(final String thingId, final Attributes attributesCreated, final long revision, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), attributesCreated, revision, null, dittoHeaders, null); } private  AttributesCreated(final ThingId thingId,
            final Attributes attributesCreated,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); @Deprecated static AttributesCreated of(final String thingId,
            final Attributes attributesCreated,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static AttributesCreated of(final ThingId thingId,
            final Attributes attributesCreated,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static AttributesCreated of(final String thingId,
            final Attributes attributesCreated,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); @Deprecated static AttributesCreated of(final ThingId thingId,
            final Attributes attributesCreated,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static AttributesCreated of(final ThingId thingId,
            final Attributes attributesCreated,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); static AttributesCreated fromJson(final String jsonString, final DittoHeaders dittoHeaders); static AttributesCreated fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); Attributes getCreatedAttributes(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override AttributesCreated setRevision(final long revision); @Override AttributesCreated setDittoHeaders(final DittoHeaders dittoHeaders); @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; }
@Test(expected = ThingIdInvalidException.class) public void tryToCreateInstanceWithNullThingIdString() { AttributesCreated.of((String) null, TestConstants.Thing.ATTRIBUTES, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullThingId() { AttributesCreated.of((ThingId) null, TestConstants.Thing.ATTRIBUTES, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullAttributeObject() { AttributesCreated.of(TestConstants.Thing.THING_ID, null, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final AttributesCreated underTest = AttributesCreated.of(TestConstants.Thing.THING_ID, TestConstants.Thing.ATTRIBUTES, TestConstants.Thing.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.EMPTY_DITTO_HEADERS, TestConstants.METADATA); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }