### Question:
MultipartBody { public Attachment getAttachment(String contentId) { for (Attachment a : atts) { if (contentId.equalsIgnoreCase(a.getContentId())) { return a; } ContentDisposition cd = a.getContentDisposition(); if (cd != null && contentId.equals(cd.getParameter("name"))) { return a; } } return null; } MultipartBody(Attachment att);  MultipartBody(List<Attachment> atts);  MultipartBody(List<Attachment> atts, boolean outbound);  MultipartBody(boolean outbound);  MultipartBody(List<Attachment> atts, MediaType mt, boolean outbound); MediaType getType(); List<Attachment> getAllAttachments(); List<Attachment> getChildAttachments(); Attachment getRootAttachment(); Attachment getAttachment(String contentId); T getAttachmentObject(String contentId, Class<T> cls); static final String INBOUND_MESSAGE_ATTACHMENTS; static final String OUTBOUND_MESSAGE_ATTACHMENTS; }### Answer:
@Test public void testGetAttachmentsById() { List<Attachment> atts = new ArrayList<>(); atts.add(createAttachment("p1")); atts.add(createAttachment("p2")); MultipartBody b = new MultipartBody(atts); assertEquals(atts.get(0), b.getAttachment("p1")); assertEquals(atts.get(1), b.getAttachment("p2")); assertNull(b.getAttachment("p3")); }