### Question:
AbstractTransport extends Transport { static Map<String,Collection<String>> extractTextParts(Multipart multiPart) throws MessagingException, IOException { HashMap<String,Collection<String>> bodies = new HashMap<>(); for(int i = 0; i < multiPart.getCount(); i++) { checkPartForTextType(bodies, multiPart.getBodyPart(i)); } return bodies; } AbstractTransport(Session session, URLName urlname); @Override void connect(String host, int port, String user, String password); @Override boolean isConnected(); @Override void close();  }### Answer:
@Test public void testExtractParts() throws Exception { MimeMultipart multipart = new MimeMultipart(); MimeBodyPart part; part = new MimeBodyPart(); part.setContent("Text 1", "text/plain"); multipart.addBodyPart(part); part = new MimeBodyPart(); part.setContent("Text 2", "text/plain"); multipart.addBodyPart(part); MimeMultipart multipartChild = new MimeMultipart(); part = new MimeBodyPart(); part.setContent("Text 3", "text/plain"); multipartChild.addBodyPart(part); part = new MimeBodyPart(); part.setContent(multipartChild, "alternative"); multipart.addBodyPart(part); Map<String,Collection<String>> map = AbstractTransport.extractTextParts(multipart); Assert.assertEquals(1, map.size()); Collection<String> content = map.get("text/plain"); Assert.assertNotNull(map); Assert.assertArrayEquals(new String[] {"Text 1", "Text 2", "Text 3"}, content.toArray()); }