Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangying committed Aug 3, 2024
1 parent 8ebcb94 commit f825433
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testDefaultValue() throws NoSuchMethodException, InvocationTargetExc
}

@Test
public void testInlineValue() {
public void testInlineValue() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
producerBase = mock(ProducerBase.class);

AvroSchema<SchemaTestUtils.Foo> fooSchema = AvroSchema.of(SchemaDefinition.<SchemaTestUtils.Foo>builder().withPojo(SchemaTestUtils.Foo.class).build());
Expand All @@ -96,6 +96,9 @@ public void testInlineValue() {

// Check kv.encoding.type INLINE
TypedMessageBuilderImpl<KeyValue> typedMessageBuilder = (TypedMessageBuilderImpl)typedMessageBuilderImpl.value(keyValue);
Method method = TypedMessageBuilderImpl.class.getDeclaredMethod("beforeSend");
method.setAccessible(true);
method.invoke(typedMessageBuilder);
ByteBuffer content = typedMessageBuilder.getContent();
byte[] contentByte = new byte[content.remaining()];
content.get(contentByte);
Expand All @@ -106,7 +109,7 @@ public void testInlineValue() {
}

@Test
public void testSeparatedValue() {
public void testSeparatedValue() throws Exception {
producerBase = mock(ProducerBase.class);

AvroSchema<SchemaTestUtils.Foo> fooSchema = AvroSchema.of(SchemaDefinition.<SchemaTestUtils.Foo>builder().withPojo(SchemaTestUtils.Foo.class).build());
Expand All @@ -124,6 +127,9 @@ public void testSeparatedValue() {

// Check kv.encoding.type SEPARATED
TypedMessageBuilderImpl typedMessageBuilder = (TypedMessageBuilderImpl)typedMessageBuilderImpl.value(keyValue);
Method method = TypedMessageBuilderImpl.class.getDeclaredMethod("beforeSend");
method.setAccessible(true);
method.invoke(typedMessageBuilder);
ByteBuffer content = typedMessageBuilder.getContent();
byte[] contentByte = new byte[content.remaining()];
content.get(contentByte);
Expand Down

0 comments on commit f825433

Please sign in to comment.