### Question:
Query extends PGMessage implements QueryPacket { public static Query loadFromPacket(byte[] packet) { String query = new PGProto(packet, 5).readNullStr(); return new Query(query); } Query();  Query(String query); static byte[] getBeginBytes(); @Override String getQuery(); @Override void setQuery(String query); static Query loadFromPacket(byte[] packet); @Override String toString(); static final byte[] BEGIN_BYTES; }### Answer:
@Test public void testLoadFromPacket() { String sql = "select 1"; Query query = new Query(sql); byte[] bytes = query.toPacket(); Query newQuery = Query.loadFromPacket(bytes); assertEquals(newQuery.toPacket(), bytes); assertEquals(newQuery.getQuery(), sql); }