### Question:
NoticeResponse extends PGMessage { public static NoticeResponse loadFromPacket(byte[] packet) { PGProto proto = new PGProto(packet, 5); List<Notice> notices = new LinkedList<>(); while (true) { byte code = proto.readByte(); if (code == 0x0) { break; } String noticeStr = proto.readNullStr(); notices.add(new Notice(code, noticeStr)); } return new NoticeResponse(notices); } NoticeResponse();  NoticeResponse(List<Notice> notices); List<Notice> getNotices(); void setNotices(List<Notice> notices); boolean addNotice(byte code, String noticeMsg); static NoticeResponse loadFromPacket(byte[] packet); @Override String toString();  }### Answer:
@Test public void testLoadFromPacket() { byte code = PGFlags.SEVERITY; String msg = Severity.WARNING.name(); NoticeResponse noticeResp = new NoticeResponse(); noticeResp.addNotice(code, msg); byte[] bytes = noticeResp.toPacket(); NoticeResponse newNotice = NoticeResponse.loadFromPacket(bytes); assertEquals(newNotice.toPacket(), bytes); assertEquals(newNotice.getNotices().size(), 1); Notice notice = newNotice.getNotices().get(0); assertEquals(notice.code, code); assertEquals(notice.getNotice(), msg); }