use of uk.gov.gchq.gaffer.parquetstore.partitioner.NegativeInfinityPartitionKey in project Gaffer by gchq.
the class PartitionKeySerialiserTest method testWithInfinitePartitionKey.
@Test
public void testWithInfinitePartitionKey(@TempDir java.nio.file.Path tempDir) throws IOException {
// Given
final PartitionKey negativeInfinity = new NegativeInfinityPartitionKey();
final PartitionKey positiveInfinity = new PositiveInfinityPartitionKey();
final PartitionKeySerialiser serialiser = new PartitionKeySerialiser();
// When
final String filename = tempDir.resolve("test").toString();
final DataOutputStream dos = new DataOutputStream(new FileOutputStream(filename));
serialiser.write(negativeInfinity, dos);
serialiser.write(positiveInfinity, dos);
dos.close();
final DataInputStream dis = new DataInputStream(new FileInputStream(filename));
final PartitionKey readPartitionKey1 = serialiser.read(dis);
final PartitionKey readPartitionKey2 = serialiser.read(dis);
dis.close();
// Then
assertEquals(negativeInfinity, readPartitionKey1);
assertEquals(positiveInfinity, readPartitionKey2);
}
Aggregations