This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3697390  KAFKA-10878 Check failed message in ProtocolSerializationTest 
(#9776)
3697390 is described below

commit 3697390402980d28e961f3094ab255dbfd8113e6
Author: Geordie <g1geor...@gmail.com>
AuthorDate: Sun Jan 10 15:10:07 2021 +0800

    KAFKA-10878 Check failed message in ProtocolSerializationTest (#9776)
    
    Reviewers: Chia-Ping Tsai <chia7...@gmail.com>
---
 .../kafka/common/protocol/types/ProtocolSerializationTest.java      | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
 
b/clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
index dfce6aa..f20aefc 100644
--- 
a/clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
+++ 
b/clients/src/test/java/org/apache/kafka/common/protocol/types/ProtocolSerializationTest.java
@@ -23,6 +23,8 @@ import org.junit.Test;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -414,7 +416,7 @@ public class ProtocolSerializationTest {
         oldFormat.writeTo(buffer);
         buffer.flip();
         SchemaException e = assertThrows(SchemaException.class, () -> 
newSchema.read(buffer));
-        e.getMessage().contains("Error reading field 'field2': 
java.nio.BufferUnderflowException");
+        assertThat(e.getMessage(), containsString("Error reading field 
'field2':"));
     }
 
     @Test
@@ -430,6 +432,6 @@ public class ProtocolSerializationTest {
         oldFormat.writeTo(buffer);
         buffer.flip();
         SchemaException e = assertThrows(SchemaException.class, () -> 
newSchema.read(buffer));
-        e.getMessage().contains("Missing value for field 'field2' which has no 
default value");
+        assertThat(e.getMessage(), containsString("Missing value for field 
'field2' which has no default value"));
     }
 }

Reply via email to