PostgreSQLRowDescriptionPacket implements PostgreSQLPacket { @Override public void write(final PostgreSQLPacketPayload payload) { payload.writeInt2(fieldCount); for (PostgreSQLColumnDescription each : columnDescriptions) { payload.writeStringNul(each.getColumnName()); payload.writeInt4(each.getTableOID()); payload.writeInt2(each.getColumnIndex()); payload.writeInt4(each.getTypeOID()); payload.writeInt2(each.getColumnLength()); payload.writeInt4(each.getTypeModifier()); payload.writeInt2(each.getDataFormat()); } }  @Override void write(final PostgreSQLPacketPayload payload);  }
@Test public void assertWrite() { PostgreSQLColumnDescription description = new PostgreSQLColumnDescription("name", 1, Types.VARCHAR, 4, null); PostgreSQLRowDescriptionPacket packet = new PostgreSQLRowDescriptionPacket(1, Collections.singletonList(description)); packet.write(payload); verify(payload, times(2)).writeInt2(1); verify(payload).writeStringNul("name"); verify(payload).writeInt4(0); verify(payload, times(2)).writeInt2(1); verify(payload).writeInt4(1043); verify(payload).writeInt2(4); verify(payload).writeInt4(-1); verify(payload).writeInt2(0); }