### Question:
Payload { public Payload addFrame(final Frame frame) { final List<Frame> newFrames = new ArrayList<>(frames); newFrames.add(frame); return new Payload(newFrames); } Payload(final List<Frame> frames);  Payload(final Frame... frames); static Payload parse(
      final ByteBuf bb, final int length, final AEAD aead, final long pn, final byte[] aad); List<Frame> getFrames(); Payload addFrame(final Frame frame); int calculateLength(); void write(final ByteBuf bb, final AEAD aead, final long pn, final byte[] aad); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void addFrame() { final Payload payload = new Payload(PingFrame.INSTANCE); final Payload withAdded = payload.addFrame(new PaddingFrame(1)); final Payload expected = new Payload(PingFrame.INSTANCE, new PaddingFrame(1)); assertEquals(expected, withAdded); assertEquals(new Payload(PingFrame.INSTANCE), payload); }