AttributeModified extends AbstractThingEvent<AttributeModified> implements ThingModifiedEvent<AttributeModified> { @Deprecated public static AttributeModified of(final String thingId, final JsonPointer attributePointer, final JsonValue attributeValue, final long revision, final DittoHeaders dittoHeaders) { return of(ThingId.of(thingId), attributePointer, attributeValue, revision, null, dittoHeaders, null); } private  AttributeModified(final ThingId thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); @Deprecated static AttributeModified of(final String thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static AttributeModified of(final ThingId thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final long revision,
            final DittoHeaders dittoHeaders); @Deprecated static AttributeModified of(final String thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); @Deprecated static AttributeModified of(final ThingId thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders); static AttributeModified of(final ThingId thingId,
            final JsonPointer attributePointer,
            final JsonValue attributeValue,
            final long revision,
            @Nullable final Instant timestamp,
            final DittoHeaders dittoHeaders,
            @Nullable final Metadata metadata); static AttributeModified fromJson(final String jsonString, final DittoHeaders dittoHeaders); static AttributeModified fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders); JsonPointer getAttributePointer(); JsonValue getAttributeValue(); @Override Optional<JsonValue> getEntity(final JsonSchemaVersion schemaVersion); @Override JsonPointer getResourcePath(); @Override AttributeModified setRevision(final long revision); @Override AttributeModified setDittoHeaders(final DittoHeaders dittoHeaders); @SuppressWarnings("squid:S109") @Override int hashCode(); @SuppressWarnings({"squid:MethodCyclomaticComplexity", "squid:S1067", "OverlyComplexMethod"}) @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() { AttributeModified.of((String) null, KNOWN_ATTRIBUTE_POINTER, NEW_ATTRIBUTE_VALUE, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullThingId() { AttributeModified.of((ThingId) null, KNOWN_ATTRIBUTE_POINTER, NEW_ATTRIBUTE_VALUE, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullAttributeKey() { AttributeModified.of(TestConstants.Thing.THING_ID, null, NEW_ATTRIBUTE_VALUE, TestConstants.Thing.REVISION_NUMBER, TestConstants.EMPTY_DITTO_HEADERS); }
@Test public void toJsonReturnsExpected() { final AttributeModified underTest = AttributeModified.of(TestConstants.Thing.THING_ID, KNOWN_ATTRIBUTE_POINTER, NEW_ATTRIBUTE_VALUE, TestConstants.Thing.REVISION_NUMBER, TestConstants.TIMESTAMP, TestConstants.EMPTY_DITTO_HEADERS, TestConstants.METADATA); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); }