clesaec commented on code in PR #2012:
URL: https://github.com/apache/avro/pull/2012#discussion_r1049813363
##########
lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java:
##########
@@ -632,10 +632,15 @@ public static class RAvroMultiMeta {
@Test
public void testAnnotationMultiAvroMeta() {
- check(RAvroMultiMeta.class,
- "{\"type\":\"record\",\"name\":\"RAvroMultiMeta\",\"namespace\":"
- + "\"org.apache.avro.reflect.TestReflect\",\"fields\":["
- + "{\"name\":\"a\",\"type\":\"int\",\"K\":\"V\",\"L\":\"W\"}]" +
",\"X\":\"Y\",\"A\":\"B\"}");
+ String schm = ReflectData.get().getSchema(RAvroMultiMeta.class).toString();
+ String expectedString =
"{\"type\":\"record\",\"name\":\"RAvroMultiMeta\",\"namespace\":"
+ + "\"org.apache.avro.reflect.TestReflect\",\"fields\":["
+ + "{\"name\":\"a\",\"type\":\"int\",\"K\":\"V\",\"L\":\"W\"}]" +
",\"X\":\"Y\",\"A\":\"B\"}";
+ char[] schmArrays = schm.toCharArray();
+ char[] expectedArrays = expectedString.toCharArray();
+ Arrays.sort(schmArrays);
+ Arrays.sort(expectedArrays);
+ assertEquals(new String(schmArrays), new String(expectedArrays));
Review Comment:
Well done, may be it should be nice to add nondex plugin in build.
For the fix, i would prefer standard schema comparison, like
```java
Field field = new Field("a", Schema.create(Schema.Type.INT));
field.addProp("L", "W");
field.addProp("K", "V");
Schema avroMultiMeta = Schema.createRecord("RAvroMultiMeta", null,
"org.apache.avro.reflect.TestReflect", false,
Arrays.asList(field));
avroMultiMeta.addProp("X", "Y");
avroMultiMeta.addProp("A", "B");
Schema schema = ReflectData.get().getSchema(RAvroMultiMeta.class);
assertEquals(avroMultiMeta, schema);
```
(In same time, it test Schema.equals method).
--
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]