chia7712 commented on code in PR #20456:
URL: https://github.com/apache/kafka/pull/20456#discussion_r2657538889
##########
transaction-coordinator/src/test/java/org/apache/kafka/coordinator/transaction/TransactionLogTest.java:
##########
@@ -268,16 +261,15 @@ void testDeserializeFutureTransactionLogValue() {
}
@Test
- void testReadTxnRecordKeyCanReadUnknownMessage() {
+ void testReadTxnRecordKeyThrowsOnUnknownVersion() {
var unknownRecord =
MessageUtil.toVersionPrefixedBytes(Short.MAX_VALUE, new TransactionLogKey());
- var result = readTxnRecordKey(wrap(unknownRecord));
-
- var uv = assertInstanceOf(TxnKeyResult.UnknownVersion.class, result);
- assertEquals(Short.MAX_VALUE, uv.version());
+ var exception = assertThrows(IllegalStateException.class,
+ () -> TransactionLog.readTxnRecordKey(wrap(unknownRecord)));
+ assertTrue(exception.getMessage().contains("Unknown version " +
Short.MAX_VALUE));
}
@Test
- void shouldReturnEmptyWhenForTombstoneRecord() {
- assertTrue(TransactionLog.readTxnRecordValue("transaction-id",
null).isEmpty());
+ void shouldReturnNullForTombstoneRecord() {
+ assertEquals(null, TransactionLog.readTxnRecordValue("transaction-id",
null));
Review Comment:
```java
assertNull(TransactionLog.readTxnRecordValue("transaction-id", null));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]