test_class.declarator: TIMESTAMP = Instant.now()
test_class.modifier: private static final
test_class.original_string: private static final Instant TIMESTAMP = Instant.now();
test_class.type: Instant
test_class.var_name: TIMESTAMP
test_class.declarator: METADATA = Metadata.newBuilder().set("foo", "bar").build()
test_class.modifier: private static final
test_class.original_string: private static final Metadata METADATA = Metadata.newBuilder().set("foo", "bar").build();
test_class.type: Metadata
test_class.var_name: METADATA
test_class.file: services/things/persistence/src/test/java/org/eclipse/ditto/services/things/persistence/actors/strategies/events/ThingCreatedStrategyTest.java
test_class.identifier: ThingCreatedStrategyTest
test_class.superclass: extends AbstractStrategyTest
test_case.body: @Test
      public void appliesEventCorrectly() {
          final ThingCreatedStrategy strategy = new ThingCreatedStrategy();
          final ThingCreated event = ThingCreated.of(THING, REVISION, TIMESTAMP, DittoHeaders.empty(), METADATA);
  
          final Thing thingWithEventApplied = strategy.handle(event, null, NEXT_REVISION);
  
          final Thing expected = THING.toBuilder()
                  .setLifecycle(ThingLifecycle.ACTIVE)
                  .setRevision(NEXT_REVISION)
                  .setModified(TIMESTAMP)
                  .setCreated(TIMESTAMP)
                  .setMetadata(METADATA)
                  .build();
  
          assertThat(thingWithEventApplied).isEqualTo(expected);
      }
test_case.class_method_signature: ThingCreatedStrategyTest.appliesEventCorrectly()
test_case.full_signature: @Test public void appliesEventCorrectly()
test_case.identifier: appliesEventCorrectly
test_case.invocations: of empty handle build setMetadata setCreated setModified setRevision setLifecycle toBuilder isEqualTo assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void appliesEventCorrectly()
focal_class.file: services/things/persistence/src/main/java/org/eclipse/ditto/services/things/persistence/actors/strategies/events/ThingCreatedStrategy.java
focal_class.identifier: ThingCreatedStrategy
focal_class.class_method_signature: ThingCreatedStrategy.handle(final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_class.full_signature: @Override public Thing handle(final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_class.identifier: handle
focal_class.modifiers: @Override public
focal_class.parameters: (final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_class.return: Thing
focal_class.signature: Thing handle(final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_class.superclass: extends AbstractThingEventStrategy<ThingCreated>
focal_method.body: @Override
      public Thing handle(final ThingCreated event, final @Nullable Thing thing, final long revision) {
          return event.getThing()
                  .toBuilder()
                  .setLifecycle(ThingLifecycle.ACTIVE)
                  .setRevision(revision)
                  .setModified(event.getTimestamp().orElseGet(() -> event.getThing().getModified().orElse(null)))
                  .setCreated(event.getTimestamp().orElseGet(() -> event.getThing().getCreated().orElse(null)))
                  .setMetadata(event.getMetadata().orElseGet(() -> event.getThing().getMetadata().orElse(null)))
                  .build();
      }
focal_method.class_method_signature: ThingCreatedStrategy.handle(final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_method.full_signature: @Override public Thing handle(final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_method.identifier: handle
focal_method.invocations: build setMetadata setCreated setModified setRevision setLifecycle toBuilder getThing orElseGet getTimestamp orElse getModified getThing orElseGet getTimestamp orElse getCreated getThing orElseGet getMetadata orElse getMetadata getThing
focal_method.modifiers: @Override public
focal_method.parameters: (final ThingCreated event, final @Nullable Thing thing, final long revision)
focal_method.return: Thing
focal_method.signature: Thing handle(final ThingCreated event, final @Nullable Thing thing, final long revision)