@Test public void getListPostAddresses_withMessageWithNo_shouldReturnEmptyList() throws Exception { MimeMessage message = buildMimeMessageWithListPostValue("NO (posting not allowed on this list)"); Address[] result = ListHeaders.getListPostAddresses(message); assertEquals(0, result.length); }
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; }