PostgreSQLBinaryResultSetRowPacket implements PostgreSQLPacket { @Override public void write(final PostgreSQLPacketPayload payload) { payload.writeInt2(data.size()); writeValues(payload); }  @Override void write(final PostgreSQLPacketPayload payload);  }
@Test public void assertWriteStringData() { PostgreSQLBinaryResultSetRowPacket rowPacket = new PostgreSQLBinaryResultSetRowPacket(Arrays.asList("value", "b"), Arrays.asList(PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR, PostgreSQLColumnType.POSTGRESQL_TYPE_VARCHAR)); assertThat(rowPacket.getData().size(), is(2)); rowPacket.write(payload); verify(payload).writeInt2(2); verify(payload).writeInt4(5); verify(payload).writeStringEOF("value"); verify(payload).writeInt4(1); verify(payload).writeStringEOF("b"); }
@Test public void assertWriteIntData() { PostgreSQLBinaryResultSetRowPacket rowPacket = new PostgreSQLBinaryResultSetRowPacket(Collections.singletonList(10), Collections.singletonList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4)); assertThat(rowPacket.getData().size(), is(1)); rowPacket.write(payload); verify(payload).writeInt2(1); verify(payload).writeInt4(4); verify(payload).writeInt4(10); }