@Test public void getListPostAddresses_shouldProvideAllListPostHeaders() throws Exception { MimeMessage message = buildMimeMessageWithListPostValue( "<mailto:list1@example.org>", "<mailto:list2@example.org>"); Address[] result = ListHeaders.getListPostAddresses(message); assertNotNull(result); assertEquals(2, result.length); assertNotNull(result[0]); assertEquals("list1@example.org", result[0].getAddress()); assertNotNull(result[1]); assertEquals("list2@example.org", result[1].getAddress()); }
public static Address[] getListPostAddresses(Message message) { String[] headerValues = message.getHeader(LIST_POST_HEADER); if (headerValues.length < 1) { return new Address[0]; } List<Address> listPostAddresses = new ArrayList<>(); for (String headerValue : headerValues) { Address address = extractAddress(headerValue); if (address != null) { listPostAddresses.add(address); } } return listPostAddresses.toArray(new Address[listPostAddresses.size()]); }
ListHeaders { public static Address[] getListPostAddresses(Message message) { String[] headerValues = message.getHeader(LIST_POST_HEADER); if (headerValues.length < 1) { return new Address[0]; } List<Address> listPostAddresses = new ArrayList<>(); for (String headerValue : headerValues) { Address address = extractAddress(headerValue); if (address != null) { listPostAddresses.add(address); } } return listPostAddresses.toArray(new Address[listPostAddresses.size()]); } }
ListHeaders { public static Address[] getListPostAddresses(Message message) { String[] headerValues = message.getHeader(LIST_POST_HEADER); if (headerValues.length < 1) { return new Address[0]; } List<Address> listPostAddresses = new ArrayList<>(); for (String headerValue : headerValues) { Address address = extractAddress(headerValue); if (address != null) { listPostAddresses.add(address); } } return listPostAddresses.toArray(new Address[listPostAddresses.size()]); }  }
ListHeaders { public static Address[] getListPostAddresses(Message message) { String[] headerValues = message.getHeader(LIST_POST_HEADER); if (headerValues.length < 1) { return new Address[0]; } List<Address> listPostAddresses = new ArrayList<>(); for (String headerValue : headerValues) { Address address = extractAddress(headerValue); if (address != null) { listPostAddresses.add(address); } } return listPostAddresses.toArray(new Address[listPostAddresses.size()]); }  static Address[] getListPostAddresses(Message message); }
ListHeaders { public static Address[] getListPostAddresses(Message message) { String[] headerValues = message.getHeader(LIST_POST_HEADER); if (headerValues.length < 1) { return new Address[0]; } List<Address> listPostAddresses = new ArrayList<>(); for (String headerValue : headerValues) { Address address = extractAddress(headerValue); if (address != null) { listPostAddresses.add(address); } } return listPostAddresses.toArray(new Address[listPostAddresses.size()]); }  static Address[] getListPostAddresses(Message message); static final String LIST_POST_HEADER; }