-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating validate to use AvroCompatHelper to get field default value (#…
…512) * Updating validate to use AvroCompatHelper to get field default value * Adding UT to check validate in CompatibleSpecificRecordBuilderBase * Checkstyle update for new file
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...com/linkedin/avroutil1/compatibility/avro110/CompatibleSpecificRecordBuilderBaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2023 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package com.linkedin.avroutil1.compatibility.avro110; | ||
|
||
import com.linkedin.avroutil1.compatibility.CompatibleSpecificRecordBuilderBase; | ||
import java.util.Arrays; | ||
import org.apache.avro.Schema; | ||
import org.testng.annotations.Test; | ||
|
||
|
||
public class CompatibleSpecificRecordBuilderBaseTest { | ||
|
||
@Test | ||
public void testValidate() { | ||
Schema.Field field = new Schema.Field("field1", Schema.create(Schema.Type.STRING), "field doc", "null"); | ||
Schema myRecord = Schema.createRecord(Arrays.asList(field)); | ||
new MyBuilderClass(myRecord).testValidate(field, null); | ||
} | ||
|
||
class MyBuilderClass extends CompatibleSpecificRecordBuilderBase { | ||
|
||
protected MyBuilderClass(Schema schema) { | ||
super(schema); | ||
} | ||
|
||
public void testValidate(Schema.Field f, Object o) { | ||
validate(f, o); | ||
} | ||
} | ||
} |