use of org.elasticsearch.common.io.stream.BytesStreamInput in project geocluster-facet by zenobase.
the class GeoClusterTests method testReadFromWriteTo.
@Test
public void testReadFromWriteTo() throws IOException {
GeoCluster expected = new GeoCluster(42, DENVER, COLORADO);
BytesStreamOutput out = new BytesStreamOutput();
expected.writeTo(out);
BytesStreamInput in = new BytesStreamInput(out.bytes());
GeoCluster actual = GeoCluster.readFrom(in);
assertThat("Center", actual.center(), closeTo(DENVER));
assertThat("Bounds", actual.bounds(), equalTo(COLORADO));
}
use of org.elasticsearch.common.io.stream.BytesStreamInput in project geocluster-facet by zenobase.
the class GeoPointsTests method testReadFromWriteTo.
@Test
public void testReadFromWriteTo() throws IOException {
BytesStreamOutput out = new BytesStreamOutput();
GeoPoints.writeTo(LAS_VEGAS, out);
BytesStreamInput in = new BytesStreamInput(out.bytes());
GeoPoint point = GeoPoints.readFrom(in);
assertThat("Latitude", point.lat(), equalTo(LAS_VEGAS.lat()));
assertThat("Longitude", point.lon(), equalTo(LAS_VEGAS.lon()));
}
use of org.elasticsearch.common.io.stream.BytesStreamInput in project geocluster-facet by zenobase.
the class GeoClusterTests method testReadFromWriteToSingleton.
@Test
public void testReadFromWriteToSingleton() throws IOException {
GeoCluster expected = new GeoCluster(DENVER);
BytesStreamOutput out = new BytesStreamOutput();
expected.writeTo(out);
BytesStreamInput in = new BytesStreamInput(out.bytes());
GeoCluster actual = GeoCluster.readFrom(in);
assertThat("Center", actual.center(), closeTo(DENVER));
assertThat("Bounds", actual.bounds(), equalTo(new GeoBoundingBox(DENVER)));
}
Aggregations