Beispiel #1
0
  @Test
  public void testBasic() throws IOException {
    PairOfLongInt pair = new PairOfLongInt(1L, 2);

    assertEquals(1L, pair.getLeftElement());
    assertEquals(2L, pair.getRightElement());
  }
Beispiel #2
0
  @Test
  public void testSerialize() throws IOException {
    PairOfLongInt origPair = new PairOfLongInt(1L, 2);

    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    DataOutputStream dataOut = new DataOutputStream(bytesOut);

    origPair.write(dataOut);

    PairOfLongInt pair = new PairOfLongInt();

    pair.readFields(new DataInputStream(new ByteArrayInputStream(bytesOut.toByteArray())));

    assertEquals(1L, pair.getLeftElement());
    assertEquals(2L, pair.getRightElement());
  }