diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/EventId.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/EventId.kt index 4d5266d5..98f14075 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/EventId.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/EventId.kt @@ -132,18 +132,18 @@ private class BuilderImpl : EventId.Builder { if (_id == null || _book == null || _scope == null || _timestamp == null) { val missing = StringJoiner(",", "[", "]") if (_id == null) { - missing.add(" id") + missing.add("id") } if (_book == null) { - missing.add(" book") + missing.add("book") } if (_scope == null) { - missing.add(" scope") + missing.add("scope") } if (_timestamp == null) { - missing.add(" timestamp") + missing.add("timestamp") } - error("Missing required properties:$missing") + error("Missing required properties: $missing") } return EventId( _id!!, diff --git a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt index bdaae691..e15d9f33 100644 --- a/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt +++ b/src/main/kotlin/com/exactpro/th2/common/schema/message/impl/rabbitmq/transport/MessageId.kt @@ -128,6 +128,7 @@ private class MessageIdBuilderImpl : MessageId.Builder { override fun isDirectionSet(): Boolean = _direction != null override fun setSequence(sequence: Long): MessageId.Builder = apply { + require(sequence > SEQUENCE_NOT_SET) { "Property \"sequence\" should not be negative" } this._sequence = sequence } @@ -172,18 +173,18 @@ private class MessageIdBuilderImpl : MessageId.Builder { if (_sessionAlias == null || _direction == null || _sequence == SEQUENCE_NOT_SET || _timestamp == null) { val missing = StringJoiner(",", "[", "]") if (_sessionAlias == null) { - missing.add(" sessionAlias") + missing.add("sessionAlias") } if (_direction == null) { - missing.add(" direction") + missing.add("direction") } if (_sequence == SEQUENCE_NOT_SET) { - missing.add(" sequence") + missing.add("sequence") } if (_timestamp == null) { - missing.add(" timestamp") + missing.add("timestamp") } - error("Missing required properties:$missing") + error("Missing required properties: $missing") } return MessageId( _sessionAlias!!,