You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2017/12/18 18:02:29 UTC
[2/4] avro git commit: AVRO-2115: Added test for Void in union.
AVRO-2115: Added test for Void in union.
Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/164ee588
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/164ee588
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/164ee588
Branch: refs/heads/master
Commit: 164ee588cf822588df2c877f07ba03cb1a4a9482
Parents: c412267
Author: Miguel Martinez-Espronceda <co...@i2p.es>
Authored: Thu Dec 14 10:12:47 2017 +0100
Committer: Miguel Martinez-Espronceda <co...@i2p.es>
Committed: Thu Dec 14 10:12:47 2017 +0100
----------------------------------------------------------------------
.../avro/src/test/java/org/apache/avro/reflect/TestReflect.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/avro/blob/164ee588/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java
index 4d8a388..51ce7c2 100644
--- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java
+++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java
@@ -299,11 +299,12 @@ public class TestReflect {
// test union in fields
public static class R9_1 {
- @Union({R7.class, R8.class})
+ @Union({Void.class, R7.class, R8.class})
public Object value;
@Override
public boolean equals(Object o) {
if (!(o instanceof R9_1)) return false;
+ if (this.value == null) return ((R9_1)o).value == null;
return this.value.equals(((R9_1)o).value);
}
}
@@ -316,6 +317,8 @@ public class TestReflect {
r8.value = 1;
checkReadWrite(r8, ReflectData.get().getSchema(R6.class));
R9_1 r9_1 = new R9_1();
+ r9_1.value = null;
+ checkReadWrite(r9_1, ReflectData.get().getSchema(R9_1.class));
r9_1.value = r7;
checkReadWrite(r9_1, ReflectData.get().getSchema(R9_1.class));
r9_1.value = r8;