test_class.declarator: THING_SIZE_LIMIT_BYTES = Long.parseLong(
              System.getProperty(ThingCommandSizeValidator.DITTO_LIMITS_THINGS_MAX_SIZE_BYTES, "-1"))
test_class.modifier: private static final
test_class.original_string: private static final long THING_SIZE_LIMIT_BYTES = Long.parseLong(
              System.getProperty(ThingCommandSizeValidator.DITTO_LIMITS_THINGS_MAX_SIZE_BYTES, "-1"));
test_class.type: long
test_class.var_name: THING_SIZE_LIMIT_BYTES
test_class.declarator: featureId
test_class.modifier: private static
test_class.original_string: private static String featureId;
test_class.type: String
test_class.var_name: featureId
test_class.declarator: modifiedFeatureProperties
test_class.modifier: private static
test_class.original_string: private static FeatureProperties modifiedFeatureProperties;
test_class.type: FeatureProperties
test_class.var_name: modifiedFeatureProperties
test_class.declarator: underTest
test_class.modifier: private
test_class.original_string: private ModifyFeaturePropertiesStrategy underTest;
test_class.type: ModifyFeaturePropertiesStrategy
test_class.var_name: underTest
test_class.file: services/things/persistence/src/test/java/org/eclipse/ditto/services/things/persistence/actors/strategies/commands/ModifyFeaturePropertiesStrategyTest.java
test_class.identifier: ModifyFeaturePropertiesStrategyTest
test_class.superclass: extends AbstractCommandStrategyTest
test_case.body: @Test
      public void modifyFeaturePropertiesSoThatThingGetsTooLarge() {
          final CommandStrategy.Context<ThingId> context = getDefaultContext();
  
          final Feature feature = Feature.newBuilder()
                  .properties(JsonObject.newBuilder().set("foo", false).set("bar", 42).build())
                  .withId("myFeature")
                  .build();
  
          final long staticOverhead = 80;
          final StringBuilder sb = new StringBuilder();
          for (int i = 0; i < THING_SIZE_LIMIT_BYTES - staticOverhead; i++) {
              sb.append('a');
          }
          final JsonObject largeAttributes = JsonObject.newBuilder()
                  .set("a", sb.toString())
                  .build();
          final ThingId thingId = ThingId.of("foo","bar");
          final Thing thing = Thing.newBuilder()
                  .setId(thingId)
                  .setAttributes(largeAttributes)
                  .build();
  
          // creating the Thing should be possible as we are below the limit:
          CreateThing.of(thing, null, DittoHeaders.empty());
  
          final ModifyFeatureProperties command =
                  ModifyFeatureProperties.of(thingId, feature.getId(), feature.getProperties().get(),
                          DittoHeaders.empty());
  
          // but modifying the feature properties which would cause the Thing to exceed the limit should not be allowed:
          assertThatThrownBy(() -> underTest.doApply(context, thing, NEXT_REVISION, command, null))
                  .isInstanceOf(ThingTooLargeException.class);
      }
test_case.class_method_signature: ModifyFeaturePropertiesStrategyTest.modifyFeaturePropertiesSoThatThingGetsTooLarge()
test_case.full_signature: @Test public void modifyFeaturePropertiesSoThatThingGetsTooLarge()
test_case.identifier: modifyFeaturePropertiesSoThatThingGetsTooLarge
test_case.invocations: getDefaultContext build withId properties newBuilder build set set newBuilder append build set newBuilder toString of build setAttributes setId newBuilder of empty of getId get getProperties empty isInstanceOf assertThatThrownBy doApply
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void modifyFeaturePropertiesSoThatThingGetsTooLarge()
focal_class.file: services/things/persistence/src/main/java/org/eclipse/ditto/services/things/persistence/actors/strategies/commands/ModifyFeaturePropertiesStrategy.java
focal_class.identifier: ModifyFeaturePropertiesStrategy
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.ModifyFeaturePropertiesStrategy()
focal_class.full_signature:   ModifyFeaturePropertiesStrategy()
focal_class.identifier: ModifyFeaturePropertiesStrategy
focal_class.parameters: ()
focal_class.signature:  ModifyFeaturePropertiesStrategy()
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_class.full_signature: @Override protected Result<ThingEvent> doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_class.identifier: doApply
focal_class.modifiers: @Override protected
focal_class.parameters: (final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_class.return: Result<ThingEvent>
focal_class.signature: Result<ThingEvent> doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.extractFeature(final ModifyFeatureProperties command, @Nullable final Thing thing)
focal_class.full_signature: private Optional<Feature> extractFeature(final ModifyFeatureProperties command, @Nullable final Thing thing)
focal_class.identifier: extractFeature
focal_class.modifiers: private
focal_class.parameters: (final ModifyFeatureProperties command, @Nullable final Thing thing)
focal_class.return: Optional<Feature>
focal_class.signature: Optional<Feature> extractFeature(final ModifyFeatureProperties command, @Nullable final Thing thing)
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.getModifyOrCreateResult(final Feature feature, final Context<ThingId> context,
              final long nextRevision, final ModifyFeatureProperties command, @Nullable final Thing thing,
              @Nullable final Metadata metadata)
focal_class.full_signature: private Result<ThingEvent> getModifyOrCreateResult(final Feature feature, final Context<ThingId> context,
              final long nextRevision, final ModifyFeatureProperties command, @Nullable final Thing thing,
              @Nullable final Metadata metadata)
focal_class.identifier: getModifyOrCreateResult
focal_class.modifiers: private
focal_class.parameters: (final Feature feature, final Context<ThingId> context,
              final long nextRevision, final ModifyFeatureProperties command, @Nullable final Thing thing,
              @Nullable final Metadata metadata)
focal_class.return: Result<ThingEvent>
focal_class.signature: Result<ThingEvent> getModifyOrCreateResult(final Feature feature, final Context<ThingId> context,
              final long nextRevision, final ModifyFeatureProperties command, @Nullable final Thing thing,
              @Nullable final Metadata metadata)
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.getModifyResult(final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.full_signature: private Result<ThingEvent> getModifyResult(final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.identifier: getModifyResult
focal_class.modifiers: private
focal_class.parameters: (final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.return: Result<ThingEvent>
focal_class.signature: Result<ThingEvent> getModifyResult(final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.getCreateResult(final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.full_signature: private Result<ThingEvent> getCreateResult(final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.identifier: getCreateResult
focal_class.modifiers: private
focal_class.parameters: (final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.return: Result<ThingEvent>
focal_class.signature: Result<ThingEvent> getCreateResult(final Context<ThingId> context, final long nextRevision,
              final ModifyFeatureProperties command, @Nullable final Thing thing, @Nullable final Metadata metadata)
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.previousEntityTag(final ModifyFeatureProperties command,
              @Nullable final Thing previousEntity)
focal_class.full_signature: @Override public Optional<EntityTag> previousEntityTag(final ModifyFeatureProperties command,
              @Nullable final Thing previousEntity)
focal_class.identifier: previousEntityTag
focal_class.modifiers: @Override public
focal_class.parameters: (final ModifyFeatureProperties command,
              @Nullable final Thing previousEntity)
focal_class.return: Optional<EntityTag>
focal_class.signature: Optional<EntityTag> previousEntityTag(final ModifyFeatureProperties command,
              @Nullable final Thing previousEntity)
focal_class.class_method_signature: ModifyFeaturePropertiesStrategy.nextEntityTag(final ModifyFeatureProperties command, @Nullable final Thing newEntity)
focal_class.full_signature: @Override public Optional<EntityTag> nextEntityTag(final ModifyFeatureProperties command, @Nullable final Thing newEntity)
focal_class.identifier: nextEntityTag
focal_class.modifiers: @Override public
focal_class.parameters: (final ModifyFeatureProperties command, @Nullable final Thing newEntity)
focal_class.return: Optional<EntityTag>
focal_class.signature: Optional<EntityTag> nextEntityTag(final ModifyFeatureProperties command, @Nullable final Thing newEntity)
focal_class.superclass: extends AbstractThingCommandStrategy<ModifyFeatureProperties>
focal_method.body: @Override
      protected Result<ThingEvent> doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata) {
  
          final String featureId = command.getFeatureId();
  
          final Thing nonNullThing = getEntityOrThrow(thing);
  
          final JsonObject thingWithoutProperties = nonNullThing.removeFeatureProperties(featureId).toJson();
          final JsonObject propertiesJsonObject = command.getProperties().toJson();
  
          ThingCommandSizeValidator.getInstance().ensureValidSize(
                  () -> {
                      final long lengthWithOutProperties = thingWithoutProperties.getUpperBoundForStringSize();
                      final long propertiesLength = propertiesJsonObject.getUpperBoundForStringSize()
                              + "properties".length() + featureId.length() + 5L;
                      return lengthWithOutProperties + propertiesLength;
                  },
                  () -> {
                      final long lengthWithOutProperties = thingWithoutProperties.toString().length();
                      final long propertiesLength = propertiesJsonObject.toString().length()
                              + "properties".length() + featureId.length() + 5L;
                      return lengthWithOutProperties + propertiesLength;
                  },
                  command::getDittoHeaders);
  
          return extractFeature(command, nonNullThing)
                  .map(feature -> getModifyOrCreateResult(feature, context, nextRevision, command, thing, metadata))
                  .orElseGet(() -> ResultFactory.newErrorResult(
                          ExceptionFactory.featureNotFound(context.getState(), featureId,
                                  command.getDittoHeaders()), command));
      }
focal_method.class_method_signature: ModifyFeaturePropertiesStrategy.doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_method.full_signature: @Override protected Result<ThingEvent> doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_method.identifier: doApply
focal_method.invocations: getFeatureId getEntityOrThrow toJson removeFeatureProperties toJson getProperties ensureValidSize getInstance getUpperBoundForStringSize getUpperBoundForStringSize length length length toString length toString length length orElseGet map extractFeature getModifyOrCreateResult newErrorResult featureNotFound getState getDittoHeaders
focal_method.modifiers: @Override protected
focal_method.parameters: (final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)
focal_method.return: Result<ThingEvent>
focal_method.signature: Result<ThingEvent> doApply(final Context<ThingId> context,
              @Nullable final Thing thing,
              final long nextRevision,
              final ModifyFeatureProperties command,
              @Nullable final Metadata metadata)