@Test
public void testEquals() {

    Struct struct1 = new Struct(FLAT_STRUCT_SCHEMA)
            .put("int8", (byte) 12)
            .put("int16", (short) 12)
            .put("int32", 12)
            .put("int64", (long) 12)
            .put("float32", 12.f)
            .put("float64", 12.)
            .put("boolean", true)
            .put("string", "foobar")
            .put("bytes", ByteBuffer.wrap("foobar".getBytes()));
    Struct struct2 = new Struct(FLAT_STRUCT_SCHEMA)
            .put("int8", (byte) 12)
            .put("int16", (short) 12)
            .put("int32", 12)
            .put("int64", (long) 12)
            .put("float32", 12.f)
            .put("float64", 12.)
            .put("boolean", true)
            .put("string", "foobar")
            .put("bytes", ByteBuffer.wrap("foobar".getBytes()));
    Struct struct3 = new Struct(FLAT_STRUCT_SCHEMA)
            .put("int8", (byte) 12)
            .put("int16", (short) 12)
            .put("int32", 12)
            .put("int64", (long) 12)
            .put("float32", 12.f)
            .put("float64", 12.)
            .put("boolean", true)
            .put("string", "mismatching string")
            .put("bytes", ByteBuffer.wrap("foobar".getBytes()));
    assertEquals(struct1, struct2);
    assertNotEquals(struct1, struct3);
    List<Byte> array = Arrays.asList((byte) 1, (byte) 2);
    Map<Integer, String> map = Collections.singletonMap(1, "string");
    struct1 = new Struct(NESTED_SCHEMA)
            .put("array", array)
            .put("map", map)
            .put("nested", new Struct(NESTED_CHILD_SCHEMA).put("int8", (byte) 12));
    List<Byte> array2 = Arrays.asList((byte) 1, (byte) 2);
    Map<Integer, String> map2 = Collections.singletonMap(1, "string");
    struct2 = new Struct(NESTED_SCHEMA)
            .put("array", array2)
            .put("map", map2)
            .put("nested", new Struct(NESTED_CHILD_SCHEMA).put("int8", (byte) 12));
    List<Byte> array3 = Arrays.asList((byte) 1, (byte) 2, (byte) 3);
    Map<Integer, String> map3 = Collections.singletonMap(2, "string");
    struct3 = new Struct(NESTED_SCHEMA)
            .put("array", array3)
            .put("map", map3)
            .put("nested", new Struct(NESTED_CHILD_SCHEMA).put("int8", (byte) 13));
    assertEquals(struct1, struct2);
    assertNotEquals(struct1, struct3);
}