void (final @NotNull ImperativeCommand.Environment env) { try { if (!records.isEmpty()) { final int recordIndex = env.generateValue(Generator.integers(0, records.size() - 1), "Attribute to torture: #%s"); final AttributeRecord record = records.get(recordIndex); final int attributeSize = record.attributeBytesLength(); //grow small attributes, shrink big attributes: final Generator<Integer> sizeGenerator; if (attributeSize <= INLINE_ATTRIBUTE_SMALLER_THAN) { sizeGenerator = Generator.integers(attributeSize, 4 * INLINE_ATTRIBUTE_SMALLER_THAN); } else { sizeGenerator = Generator.integers(0, 2 * INLINE_ATTRIBUTE_SMALLER_THAN); } final Integer newSize = env.generateValue(sizeGenerator, "New attribute size: %s bytes"); final AttributeRecord updatedRecord = attributes.insertOrUpdateRecord( record.withRandomAttributeBytes(newSize), storage ); records.set(recordIndex, updatedRecord); assertTrue( updatedRecord.existsInStorage(storage) ); assertArrayEquals( updatedRecord.readValueFromStorage(storage), updatedRecord.attributeBytes() ); assertArrayEquals( updatedRecord.readValueFromStorageRaw(storage), updatedRecord.attributeBytes() ); } } catch (IOException e) { throw new AssertionError(e); } }