use of org.elasticsearch.search.SearchHit.NestedIdentity in project elasticsearch by elastic.
the class NestedIdentityTests method testSerialization.
public void testSerialization() throws IOException {
NestedIdentity nestedIdentity = createTestItem(randomInt(3));
try (BytesStreamOutput output = new BytesStreamOutput()) {
nestedIdentity.writeTo(output);
try (StreamInput in = output.bytes().streamInput()) {
NestedIdentity deserializedCopy = new NestedIdentity(in);
assertEquals(nestedIdentity, deserializedCopy);
assertEquals(nestedIdentity.hashCode(), deserializedCopy.hashCode());
assertNotSame(nestedIdentity, deserializedCopy);
}
}
}
Aggregations