target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void open_withEhloFailing_shouldTryHelo() throws Exception { MockSmtpServer server = new MockSmtpServer(); server.output("220 localhost Simple Mail Transfer Service Ready"); server.expect("EHLO localhost"); server.output("502 5.5.1, Unrecognized command."); server.expect("HELO localhost"); server.output("2... | @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (connectionSecurity == ConnectionSecur... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... |
@Test public void open_withSupportWithEnhancedStatusCodesOnAuthFailure_shouldThrowEncodedMessage() throws Exception { MockSmtpServer server = new MockSmtpServer(); server.output("220 localhost Simple Mail Transfer Service Ready"); server.expect("EHLO localhost"); server.output("250-localhost Hello client.localhost"); s... | @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (connectionSecurity == ConnectionSecur... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... |
@Test public void open_withManyExtensions_shouldParseAll() throws Exception { MockSmtpServer server = new MockSmtpServer(); server.output("220 smtp.gmail.com ESMTP x25sm19117693wrx.27 - gsmtp"); server.expect("EHLO localhost"); server.output("250-smtp.gmail.com at your service, [86.147.34.216]"); server.output("250-SIZ... | @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (connectionSecurity == ConnectionSecur... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... | SmtpTransport extends Transport { @Override public void open() throws MessagingException { try { boolean secureConnection = false; InetAddress[] addresses = InetAddress.getAllByName(host); for (int i = 0; i < addresses.length; i++) { try { SocketAddress socketAddress = new InetSocketAddress(addresses[i], port); if (con... |
@Test public void sendMessage_withoutAddressToSendTo_shouldNotOpenConnection() throws Exception { MimeMessage message = new MimeMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication(); SmtpTransport transport = startServerAndCreateSmtpTransport(server); transport.sendMessage(message); server.ver... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void buildUserId_withName_shouldCreateOpenPgpAccountName() { Identity identity = new Identity(); identity.setEmail("user@domain.com"); identity.setName("Name"); String result = OpenPgpApiHelper.buildUserId(identity); assertEquals("Name <user@domain.com>", result); } | public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } } | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } } | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } static String buildUserId(Ide... | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } static String buildUserId(Ide... |
@Test public void sendMessage_withSingleRecipient() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication(); server.expect("MAIL FROM:<user@localhost>"); server.output("250 OK"); server.expect("RCPT TO:<user2@localhost>"); server.output("250 OK"); s... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessage_with8BitEncoding() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("8BITMIME"); server.expect("MAIL FROM:<user@localhost> BODY=8BITMIME"); server.output("250 OK"); server.expect("RCPT TO:<user2@localhost>"); serve... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessage_with8BitEncodingExtensionNotCaseSensitive() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("8bitmime"); server.expect("MAIL FROM:<user@localhost> BODY=8BITMIME"); server.output("250 OK"); server.expect("RCPT TO:<... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessage_withMessageTooLarge_shouldThrow() throws Exception { Message message = getDefaultMessageBuilder() .setHasAttachments(true) .messageSize(1234L) .build(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("SIZE 1000"); SmtpTransport transport = startServerAndCreateSmtpTransp... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessage_withNegativeReply_shouldThrow() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication(); server.expect("MAIL FROM:<user@localhost>"); server.output("250 OK"); server.expect("RCPT TO:<user2@localhost>"); server.output("2... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessage_withPipelining() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("PIPELINING"); server.expect("MAIL FROM:<user@localhost>"); server.expect("RCPT TO:<user2@localhost>"); server.expect("DATA"); server.output("250 OK... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessage_withoutPipelining() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication(); server.expect("MAIL FROM:<user@localhost>"); server.output("250 OK"); server.expect("RCPT TO:<user2@localhost>"); server.output("250 OK"); ser... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessagePipelining_withNegativeReply() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("PIPELINING"); server.expect("MAIL FROM:<user@localhost>"); server.expect("RCPT TO:<user2@localhost>"); server.expect("DATA"); server.o... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessagePipelining_without354ReplyforData_shouldThrow() throws Exception { Message message = getDefaultMessage(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("PIPELINING"); server.expect("MAIL FROM:<user@localhost>"); server.expect("RCPT TO:<user2@localhost>"); server.expect(... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void sendMessagePipelining_with250and550ReplyforRecipients_shouldThrow() throws Exception { Message message = getMessageWithTwoRecipients(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("PIPELINING"); server.expect("MAIL FROM:<user@localhost>"); server.expect("RCPT TO:<user2@localhost... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void buildUserId_withoutName_shouldCreateOpenPgpAccountName() { Identity identity = new Identity(); identity.setEmail("user@domain.com"); String result = OpenPgpApiHelper.buildUserId(identity); assertEquals("<user@domain.com>", result); } | public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } } | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } } | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } static String buildUserId(Ide... | OpenPgpApiHelper { public static String buildUserId(Identity identity) { StringBuilder sb = new StringBuilder(); String name = identity.getName(); if (!TextUtils.isEmpty(name)) { sb.append(name).append(" "); } sb.append("<").append(identity.getEmail()).append(">"); return sb.toString(); } static String buildUserId(Ide... |
@Test public void sendMessagePipelining_with250and550ReplyforRecipientsAnd250ForMessage_shouldThrow() throws Exception { Message message = getMessageWithTwoRecipients(); MockSmtpServer server = createServerAndSetupForPlainAuthentication("PIPELINING"); server.expect("MAIL FROM:<user@localhost>"); server.expect("RCPT TO:... | @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.addAll(Arrays.asList(message.getReci... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... | SmtpTransport extends Transport { @Override public void sendMessage(Message message) throws MessagingException { List<Address> addresses = new ArrayList<>(); { addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO))); addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC))); addresses.ad... |
@Test public void generateMessageId_withFromAndReplyToAddress() throws Exception { Message message = new MimeMessage(); message.setFrom(new Address("alice@example.org")); message.setReplyTo(Address.parse("bob@example.com")); String result = messageIdGenerator.generateMessageId(message); assertEquals("<00000000-0000-400... | public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { hostname = replyTo[0]... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... |
@Test public void generateMessageId_withReplyToAddress() throws Exception { Message message = new MimeMessage(); message.setReplyTo(Address.parse("bob@example.com")); String result = messageIdGenerator.generateMessageId(message); assertEquals("<00000000-0000-4000-0000-000000000000@example.com>", result); } | public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { hostname = replyTo[0]... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... |
@Test public void generateMessageId_withoutRelevantHeaders() throws Exception { Message message = new MimeMessage(); String result = messageIdGenerator.generateMessageId(message); assertEquals("<00000000-0000-4000-0000-000000000000@email.android.com>", result); } | public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { hostname = replyTo[0]... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... | MessageIdGenerator { public String generateMessageId(Message message) { String hostname = null; Address[] from = message.getFrom(); if (from != null && from.length >= 1) { hostname = from[0].getHostname(); } if (hostname == null) { Address[] replyTo = message.getReplyTo(); if (replyTo != null && replyTo.length >= 1) { ... |
@Test public void getTextFromPart_withNoBody_shouldReturnNull() throws Exception { part.setBody(null); String result = MessageExtractor.getTextFromPart(part); assertNull(result); } | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void getTextFromPart_withTextBody_shouldReturnText() throws Exception { part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain; charset=utf-8"); BinaryMemoryBody body = new BinaryMemoryBody("Sample text body".getBytes(), MimeUtil.ENC_8BIT); part.setBody(body); String result = MessageExtractor.getTextFr... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void getTextFromPart_withRawDataBodyWithNonText_shouldReturnNull() throws Exception { part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "image/jpeg"); BinaryMemoryBody body = new BinaryMemoryBody("Sample text body".getBytes(), MimeUtil.ENC_8BIT); part.setBody(body); String result = MessageExtractor.getTextFro... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void getTextFromPart_withExceptionThrownGettingInputStream_shouldReturnNull() throws Exception { part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/html"); Body body = mock(Body.class); when(body.getInputStream()).thenThrow(new MessagingException("Test")); part.setBody(body); String result = MessageExtra... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void getTextFromPart_withUnknownEncoding_shouldReturnUnmodifiedBodyContents() throws Exception { part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain"); String bodyText = "Sample text body"; BinaryMemoryBody body = new BinaryMemoryBody(bodyText.getBytes(), "unknown encoding"); part.setBody(body); Str... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void getTextFromPart_withPlainTextWithCharsetInContentTypeRawDataBody_shouldReturnText() throws Exception { part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain; charset=UTF-8"); BinaryMemoryBody body = new BinaryMemoryBody("Sample text body".getBytes(), MimeUtil.ENC_8BIT); part.setBody(body); String... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void shouldStripSignature() throws Exception { String text = "This is the body text\r\n" + "\r\n" + "-- \r\n" + "Sent from my Android device with K-9 Mail. Please excuse my brevity."; String withoutSignature = TextSignatureRemover.stripSignature(text); assertEquals("This is the body text\r\n\r\n", withoutS... | public static String stripSignature(String content) { if (DASH_SIGNATURE_PLAIN.matcher(content).find()) { content = DASH_SIGNATURE_PLAIN.matcher(content).replaceFirst("\r\n"); } return content; } | TextSignatureRemover { public static String stripSignature(String content) { if (DASH_SIGNATURE_PLAIN.matcher(content).find()) { content = DASH_SIGNATURE_PLAIN.matcher(content).replaceFirst("\r\n"); } return content; } } | TextSignatureRemover { public static String stripSignature(String content) { if (DASH_SIGNATURE_PLAIN.matcher(content).find()) { content = DASH_SIGNATURE_PLAIN.matcher(content).replaceFirst("\r\n"); } return content; } } | TextSignatureRemover { public static String stripSignature(String content) { if (DASH_SIGNATURE_PLAIN.matcher(content).find()) { content = DASH_SIGNATURE_PLAIN.matcher(content).replaceFirst("\r\n"); } return content; } static String stripSignature(String content); } | TextSignatureRemover { public static String stripSignature(String content) { if (DASH_SIGNATURE_PLAIN.matcher(content).find()) { content = DASH_SIGNATURE_PLAIN.matcher(content).replaceFirst("\r\n"); } return content; } static String stripSignature(String content); } |
@Test public void getTextFromPart_withHtmlWithCharsetInContentTypeRawDataBody_shouldReturnHtmlText() throws Exception { part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/html; charset=UTF-8"); BinaryMemoryBody body = new BinaryMemoryBody( "<html><body>Sample text body</body></html>".getBytes(), MimeUtil.ENC_8BIT); p... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void getTextFromPart_withHtmlWithCharsetInHtmlRawDataBody_shouldReturnHtmlText() throws Exception { String bodyText = "<html><head>" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" + "</head><body>Sample text body</body></html>"; BinaryMemoryBody body = new BinaryMemoryBody(body... | public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); } | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... | MessageExtractor { public static String getTextFromPart(Part part) { return getTextFromPart(part, NO_TEXT_SIZE_LIMIT); } private MessageExtractor(); static String getTextFromPart(Part part); static String getTextFromPart(Part part, long textSizeLimit); static boolean hasMissingParts(Part part); static void findViewabl... |
@Test public void isFormatFlowed_withTextPlainFormatFlowed_shouldReturnTrue() throws Exception { assertTrue(isFormatFlowed("text/plain; format=flowed")); } | static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } return false; } | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... |
@Test public void isFormatFlowed_withTextPlain_shouldReturnFalse() throws Exception { assertFalse(isFormatFlowed("text/plain")); } | static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } return false; } | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... |
@Test public void isFormatFlowed_withTextHtmlFormatFlowed_shouldReturnFalse() throws Exception { assertFalse(isFormatFlowed("text/html; format=flowed")); } | static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } return false; } | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... | FlowedMessageUtils { static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } re... |
@Test public void isDelSp_withFormatFlowed_shouldReturnTrue() throws Exception { assertTrue(isDelSp("text/plain; format=flowed; delsp=yes")); } | static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } |
@Test public void isDelSp_withTextPlainFormatFlowed_shoulReturnFalse() throws Exception { assertFalse(isDelSp("text/plain; format=flowed")); } | static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } |
@Test public void isDelSp_withoutFormatFlowed_shouldReturnFalse() throws Exception { assertFalse(isDelSp("text/plain; delsp=yes")); } | static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } |
@Test public void idDelSp_withTextHtmlFormatFlowed_shouldReturnFalse() throws Exception { assertFalse(isDelSp("text/html; format=flowed; delsp=yes")); } | static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } | FlowedMessageUtils { static boolean isDelSp(String contentType) { if (isFormatFlowed(contentType)) { String delSpParameter = getHeaderParameter(contentType, HEADER_PARAM_DELSP); return HEADER_DELSP_YES.equalsIgnoreCase(delSpParameter); } return false; } } |
@Test public void getListPostAddresses_withMailTo_shouldReturnCorrectAddress() throws Exception { for (String emailAddress : TEST_EMAIL_ADDRESSES) { String headerValue = "<mailto:" + emailAddress + ">"; Message message = buildMimeMessageWithListPostValue(headerValue); Address[] result = ListHeaders.getListPostAddresses... | 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... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... |
@Test public void shouldStripSignatureFromK9StyleHtml() throws Exception { String html = "This is the body text" + "<br>" + "-- <br>" + "Sent from my Android device with K-9 Mail. Please excuse my brevity."; String withoutSignature = HtmlSignatureRemover.stripSignature(html); assertEquals("This is the body text", extra... | public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } |
@Test public void getListPostAddresses_withMailtoWithNote_shouldReturnCorrectAddress() throws Exception { for (String emailAddress : TEST_EMAIL_ADDRESSES) { String headerValue = "<mailto:" + emailAddress + "> (Postings are Moderated)"; Message message = buildMimeMessageWithListPostValue(headerValue); Address[] result =... | 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... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... |
@Test public void getListPostAddresses_withMailtoWithSubject_shouldReturnCorrectAddress() throws Exception { for (String emailAddress : TEST_EMAIL_ADDRESSES) { String headerValue = "<mailto:" + emailAddress + "?subject=list%20posting>"; Message message = buildMimeMessageWithListPostValue(headerValue); Address[] result ... | 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... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... |
@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... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... |
@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.le... | 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... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... |
@Test public void getListPostAddresses_withoutMailtoUriInBrackets_shouldReturnEmptyList() throws Exception { MimeMessage message = buildMimeMessageWithListPostValue("<x-mailto:something>"); 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... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... | 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 = extractAddre... |
@Test public void testGetHeaderParameter() { String result; result = MimeUtility.getHeaderParameter(";", null); assertEquals(null, result); result = MimeUtility.getHeaderParameter("name", "name"); assertEquals(null, result); result = MimeUtility.getHeaderParameter("name=", "name"); assertEquals("", result); result = Mi... | public static String getHeaderParameter(String headerValue, String parameterName) { if (headerValue == null) { return null; } headerValue = headerValue.replaceAll("\r|\n", ""); String[] parts = headerValue.split(";"); if (parameterName == null && parts.length > 0) { return parts[0].trim(); } for (String part : parts) {... | MimeUtility { public static String getHeaderParameter(String headerValue, String parameterName) { if (headerValue == null) { return null; } headerValue = headerValue.replaceAll("\r|\n", ""); String[] parts = headerValue.split(";"); if (parameterName == null && parts.length > 0) { return parts[0].trim(); } for (String p... | MimeUtility { public static String getHeaderParameter(String headerValue, String parameterName) { if (headerValue == null) { return null; } headerValue = headerValue.replaceAll("\r|\n", ""); String[] parts = headerValue.split(";"); if (parameterName == null && parts.length > 0) { return parts[0].trim(); } for (String p... | MimeUtility { public static String getHeaderParameter(String headerValue, String parameterName) { if (headerValue == null) { return null; } headerValue = headerValue.replaceAll("\r|\n", ""); String[] parts = headerValue.split(";"); if (parameterName == null && parts.length > 0) { return parts[0].trim(); } for (String p... | MimeUtility { public static String getHeaderParameter(String headerValue, String parameterName) { if (headerValue == null) { return null; } headerValue = headerValue.replaceAll("\r|\n", ""); String[] parts = headerValue.split(";"); if (parameterName == null && parts.length > 0) { return parts[0].trim(); } for (String p... |
@Test public void isMultipart_withLowerCaseMultipart_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isMultipart("multipart/mixed")); } | public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... |
@Test public void isMultipart_withUpperCaseMultipart_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isMultipart("MULTIPART/ALTERNATIVE")); } | public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... |
@Test public void isMultipart_withMixedCaseMultipart_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isMultipart("Multipart/Alternative")); } | public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... |
@Test public void isMultipart_withoutMultipart_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isMultipart("message/rfc822")); } | public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... |
@Test public void shouldStripSignatureFromThunderbirdStyleHtml() throws Exception { String html = "<html>\r\n" + " <head>\r\n" + " <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n" + " </head>\r\n" + " <body bgcolor=\"#FFFFFF\" text=\"#000000\">\r\n" + " <p>This is the body text<br>\r\n" + " ... | public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } |
@Test public void findPrimaryCryptoPart_withEmptyMultipartMixed_shouldReturnNull() throws Exception { List<Part> outputExtraParts = new ArrayList<>(); Message message = messageFromBody( multipart("mixed") ); Part cryptoPart = MessageDecryptVerifier.findPrimaryEncryptedOrSignedPart(message, outputExtraParts); assertNull... | public static Part findPrimaryEncryptedOrSignedPart(Part part, List<Part> outputExtraParts) { if (isPartEncryptedOrSigned(part)) { return part; } Part foundPart; foundPart = findPrimaryPartInAlternative(part); if (foundPart != null) { return foundPart; } foundPart = findPrimaryPartInMixed(part, outputExtraParts); if (f... | MessageDecryptVerifier { public static Part findPrimaryEncryptedOrSignedPart(Part part, List<Part> outputExtraParts) { if (isPartEncryptedOrSigned(part)) { return part; } Part foundPart; foundPart = findPrimaryPartInAlternative(part); if (foundPart != null) { return foundPart; } foundPart = findPrimaryPartInMixed(part,... | MessageDecryptVerifier { public static Part findPrimaryEncryptedOrSignedPart(Part part, List<Part> outputExtraParts) { if (isPartEncryptedOrSigned(part)) { return part; } Part foundPart; foundPart = findPrimaryPartInAlternative(part); if (foundPart != null) { return foundPart; } foundPart = findPrimaryPartInMixed(part,... | MessageDecryptVerifier { public static Part findPrimaryEncryptedOrSignedPart(Part part, List<Part> outputExtraParts) { if (isPartEncryptedOrSigned(part)) { return part; } Part foundPart; foundPart = findPrimaryPartInAlternative(part); if (foundPart != null) { return foundPart; } foundPart = findPrimaryPartInMixed(part,... | MessageDecryptVerifier { public static Part findPrimaryEncryptedOrSignedPart(Part part, List<Part> outputExtraParts) { if (isPartEncryptedOrSigned(part)) { return part; } Part foundPart; foundPart = findPrimaryPartInAlternative(part); if (foundPart != null) { return foundPart; } foundPart = findPrimaryPartInMixed(part,... |
@Test public void isMultipart_withNullArgument_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isMultipart(null)); } | public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } } | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... | MimeUtility { public static boolean isMultipart(String mimeType) { return mimeType != null && mimeType.toLowerCase(Locale.US).startsWith("multipart/"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String... |
@Test public void isMessage_withLowerCaseMessage_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isMessage("message/rfc822")); } | public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... |
@Test public void isMessage_withUpperCaseMessage_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isMessage("MESSAGE/RFC822")); } | public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... |
@Test public void isMessage_withMixedCaseMessage_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isMessage("Message/Rfc822")); } | public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... |
@Test public void isMessage_withoutMessageRfc822_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isMessage("Message/Partial")); } | public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... |
@Test public void isMessage_withoutMessage_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isMessage("multipart/mixed")); } | public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... |
@Test public void isMessage_withNullArgument_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isMessage(null)); } | public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } } | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... | MimeUtility { public static boolean isMessage(String mimeType) { return isSameMimeType(mimeType, "message/rfc822"); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEncode(String s); static String getHeaderParamete... |
@Test public void isSameMimeType_withSameTypeAndCase_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isSameMimeType("text/plain", "text/plain")); } | public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... |
@Test public void isSameMimeType_withSameTypeButMixedCase_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isSameMimeType("text/plain", "Text/Plain")); } | public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... |
@Test public void isSameMimeType_withSameTypeAndLowerAndUpperCase_shouldReturnTrue() throws Exception { assertTrue(MimeUtility.isSameMimeType("TEXT/PLAIN", "text/plain")); } | public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... |
@Test public void shouldStripSignatureBeforeBlockquoteTag() throws Exception { String html = "<html><head></head><body>" + "<div>" + "This is the body text" + "<br>" + "-- <br>" + "<blockquote>" + "Sent from my Android device with K-9 Mail. Please excuse my brevity." + "</blockquote>" + "</div>" + "</body></html>"; Str... | public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } |
@Test public void isSameMimeType_withDifferentType_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isSameMimeType("text/plain", "text/html")); } | public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... |
@Test public void isSameMimeType_withFirstArgumentBeingNull_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isSameMimeType(null, "text/html")); } | public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... |
@Test public void isSameMimeType_withSecondArgumentBeingNull_shouldReturnFalse() throws Exception { assertFalse(MimeUtility.isSameMimeType("text/html", null)); } | public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } } | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... | MimeUtility { public static boolean isSameMimeType(String mimeType, String otherMimeType) { return mimeType != null && mimeType.equalsIgnoreCase(otherMimeType); } static String unfold(String s); static String unfoldAndDecode(String s); static String unfoldAndDecode(String s, Message message); static String foldAndEnco... |
@Test public void testFixupCharset() throws Exception { String charsetOnMail; String expect; charsetOnMail = "CP932"; expect = "shift_jis"; assertEquals(expect, CharsetSupport.fixupCharset(charsetOnMail, new MimeMessage())); MimeMessage message; message = new MimeMessage(); message.setHeader("From", "aaa@docomo.ne.jp")... | static String fixupCharset(String charset, Message message) throws MessagingException { if (charset == null || "0".equals(charset)) charset = "US-ASCII"; charset = charset.toLowerCase(Locale.US); if (charset.equals("cp932")) charset = SHIFT_JIS; if (charset.equals(SHIFT_JIS) || charset.equals("iso-2022-jp")) { String v... | CharsetSupport { static String fixupCharset(String charset, Message message) throws MessagingException { if (charset == null || "0".equals(charset)) charset = "US-ASCII"; charset = charset.toLowerCase(Locale.US); if (charset.equals("cp932")) charset = SHIFT_JIS; if (charset.equals(SHIFT_JIS) || charset.equals("iso-2022... | CharsetSupport { static String fixupCharset(String charset, Message message) throws MessagingException { if (charset == null || "0".equals(charset)) charset = "US-ASCII"; charset = charset.toLowerCase(Locale.US); if (charset.equals("cp932")) charset = SHIFT_JIS; if (charset.equals(SHIFT_JIS) || charset.equals("iso-2022... | CharsetSupport { static String fixupCharset(String charset, Message message) throws MessagingException { if (charset == null || "0".equals(charset)) charset = "US-ASCII"; charset = charset.toLowerCase(Locale.US); if (charset.equals("cp932")) charset = SHIFT_JIS; if (charset.equals(SHIFT_JIS) || charset.equals("iso-2022... | CharsetSupport { static String fixupCharset(String charset, Message message) throws MessagingException { if (charset == null || "0".equals(charset)) charset = "US-ASCII"; charset = charset.toLowerCase(Locale.US); if (charset.equals("cp932")) charset = SHIFT_JIS; if (charset.equals(SHIFT_JIS) || charset.equals("iso-2022... |
@Test public void testDecodeEncodedWords() { String body, expect; MimeMessage message; body = "abc"; expect = "abc"; message = null; assertEquals(expect, DecoderUtil.decodeEncodedWords(body, message)); body = "=?us-ascii?q?abc?="; expect = "abc"; message = null; assertEquals(expect, DecoderUtil.decodeEncodedWords(body,... | public static String decodeEncodedWords(String body, Message message) { if (!body.contains("=?")) { return body; } int previousEnd = 0; boolean previousWasEncoded = false; StringBuilder sb = new StringBuilder(); while (true) { int begin = body.indexOf("=?", previousEnd); if (begin == -1) { sb.append(body.substring(prev... | DecoderUtil { public static String decodeEncodedWords(String body, Message message) { if (!body.contains("=?")) { return body; } int previousEnd = 0; boolean previousWasEncoded = false; StringBuilder sb = new StringBuilder(); while (true) { int begin = body.indexOf("=?", previousEnd); if (begin == -1) { sb.append(body.... | DecoderUtil { public static String decodeEncodedWords(String body, Message message) { if (!body.contains("=?")) { return body; } int previousEnd = 0; boolean previousWasEncoded = false; StringBuilder sb = new StringBuilder(); while (true) { int begin = body.indexOf("=?", previousEnd); if (begin == -1) { sb.append(body.... | DecoderUtil { public static String decodeEncodedWords(String body, Message message) { if (!body.contains("=?")) { return body; } int previousEnd = 0; boolean previousWasEncoded = false; StringBuilder sb = new StringBuilder(); while (true) { int begin = body.indexOf("=?", previousEnd); if (begin == -1) { sb.append(body.... | DecoderUtil { public static String decodeEncodedWords(String body, Message message) { if (!body.contains("=?")) { return body; } int previousEnd = 0; boolean previousWasEncoded = false; StringBuilder sb = new StringBuilder(); while (true) { int begin = body.indexOf("=?", previousEnd); if (begin == -1) { sb.append(body.... |
@Test public void dotAtStartOfLine() throws IOException { smtpDataStuffing.write(bytesFor("Hello dot\r\n.")); assertEquals("Hello dot\r\n..", buffer.readUtf8()); } | @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; } else { state = STATE_NORMAL; } super.write(o... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... |
@Test public void dotAtStartOfStream() throws IOException { smtpDataStuffing.write(bytesFor(".Hello dots")); assertEquals("..Hello dots", buffer.readUtf8()); } | @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; } else { state = STATE_NORMAL; } super.write(o... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... |
@Test public void linesNotStartingWithDot() throws IOException { smtpDataStuffing.write(bytesFor("Hello\r\nworld\r\n")); assertEquals("Hello\r\nworld\r\n", buffer.readUtf8()); } | @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; } else { state = STATE_NORMAL; } super.write(o... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... |
@Test public void dotsThatNeedStuffingMixedWithOnesThatDoNot() throws IOException { smtpDataStuffing.write(bytesFor("\r\n.Hello . dots.\r\n..\r\n.\r\n...")); assertEquals("\r\n..Hello . dots.\r\n...\r\n..\r\n....", buffer.readUtf8()); } | @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; } else { state = STATE_NORMAL; } super.write(o... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... | SmtpDataStuffing extends FilterOutputStream { @Override public void write(int oneByte) throws IOException { if (oneByte == '\r') { state = STATE_CR; } else if ((state == STATE_CR) && (oneByte == '\n')) { state = STATE_CRLF; } else if ((state == STATE_CRLF) && (oneByte == '.')) { super.write('.'); state = STATE_NORMAL; ... |
@Test public void read_withOverSizedByteArray_shouldReturnDataUpToLimit() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 6); byte[] data = new byte[100]; int numberOfBytesRead = fixedLengthInputStream.read(data); assertEquals(6, numberOfBytesRea... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void shouldNotStripSignatureInsideBlockquoteTags() throws Exception { String html = "<html><head></head><body>" + "<blockquote>" + "This is some quoted text" + "<br>" + "-- <br>" + "Inner signature" + "</blockquote>" + "<div>" + "This is the body text" + "</div>" + "</body></html>"; String withoutSignature... | public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } |
@Test public void read_withOverSizedByteArray_shouldNotConsumeMoreThanLimitFromUnderlyingStream() throws Exception { InputStream inputStream = inputStream("Hello World"); FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream, 6); fixedLengthInputStream.read(new byte[100]); assertRemaini... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void read_withByteArraySmallerThanLimit_shouldConsumeSizeOfByteArray() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 6); byte[] data = new byte[5]; int numberOfBytesRead = fixedLengthInputStream.read(data); assertEquals(5, numberOf... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void read_withOverSizedByteArrayInMiddleOfStream_shouldReturnDataUpToLimit() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 6); consumeBytes(fixedLengthInputStream, 5); byte[] data = new byte[10]; int numberOfBytesRead = fixedLength... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void read_withOverSizedByteArrayInMiddleOfStream_shouldNotConsumeMoreThanLimitFromUnderlyingStream() throws Exception { InputStream inputStream = inputStream("Hello World"); FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream, 6); consumeBytes(fixedLengthInputStream, 5); ... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void read_atStartOfStream() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Word"), 2); int readByte = fixedLengthInputStream.read(); assertEquals('W', (char) readByte); } | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void read_inMiddleOfStream() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Word"), 2); consumeBytes(fixedLengthInputStream, 1); int readByte = fixedLengthInputStream.read(); assertEquals('o', (char) readByte); } | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void read_atEndOfStream_shouldReturnMinusOne() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello world"), 5); exhaustStream(fixedLengthInputStream); int readByte = fixedLengthInputStream.read(); assertEquals(-1, readByte); } | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void readArray_atEndOfStream_shouldReturnMinusOne() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello world"), 5); exhaustStream(fixedLengthInputStream); int numberOfBytesRead = fixedLengthInputStream.read(new byte[2]); assertEquals(-1, numberO... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void readArrayWithOffset_atEndOfStream_shouldReturnMinusOne() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello world"), 5); exhaustStream(fixedLengthInputStream); int numberOfBytesRead = fixedLengthInputStream.read(new byte[2], 0, 2); assertEq... | @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... | FixedLengthInputStream extends InputStream { @Override public int read() throws IOException { if (mCount >= mLength) { return -1; } int d = mIn.read(); if (d != -1) { mCount++; } return d; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b,... |
@Test public void available_atStartOfStream() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 5); int available = fixedLengthInputStream.available(); assertEquals(5, available); } | @Override public int available() throws IOException { return mLength - mCount; } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... |
@Test public void shouldStripSignatureBetweenBlockquoteTags() throws Exception { String html = "<html><head></head><body>" + "<blockquote>" + "Some quote" + "</blockquote>" + "<div>" + "This is the body text" + "<br>" + "-- <br>" + "<blockquote>" + "Sent from my Android device with K-9 Mail. Please excuse my brevity." ... | public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } |
@Test public void available_afterPartialReadArray() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 5); consumeBytes(fixedLengthInputStream, 2); int available = fixedLengthInputStream.available(); assertEquals(3, available); } | @Override public int available() throws IOException { return mLength - mCount; } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... |
@Test public void available_afterStreamHasBeenExhausted() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 5); exhaustStream(fixedLengthInputStream); int available = fixedLengthInputStream.available(); assertEquals(0, available); } | @Override public int available() throws IOException { return mLength - mCount; } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... |
@Test public void available_afterSkip() throws Exception { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 5); guaranteedSkip(fixedLengthInputStream, 2); int available = fixedLengthInputStream.available(); assertEquals(3, available); } | @Override public int available() throws IOException { return mLength - mCount; } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... | FixedLengthInputStream extends InputStream { @Override public int available() throws IOException { return mLength - mCount; } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byte[] b); @Override... |
@Test public void skipRemaining_shouldExhaustStream() throws IOException { FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream("Hello World"), 5); fixedLengthInputStream.skipRemaining(); assertInputStreamExhausted(fixedLengthInputStream); } | public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } } | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byt... | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byt... |
@Test public void skipRemaining_shouldNotConsumeMoreThanLimitFromUnderlyingInputStream() throws IOException { InputStream inputStream = inputStream("Hello World"); FixedLengthInputStream fixedLengthInputStream = new FixedLengthInputStream(inputStream, 6); fixedLengthInputStream.skipRemaining(); assertRemainingInputStre... | public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } } | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); } | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byt... | FixedLengthInputStream extends InputStream { public void skipRemaining() throws IOException { while (available() > 0) { skip(available()); } } FixedLengthInputStream(InputStream in, int length); @Override int available(); @Override int read(); @Override int read(byte[] b, int offset, int length); @Override int read(byt... |
@Test public void testSignSafeOutputStream() throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); OutputStream output = new SignSafeOutputStream(byteArrayOutputStream); output.write(INPUT_STRING.getBytes("US-ASCII")); output.close(); assertEquals(EXPECTED_SIGNSAFE, new String(... | public SignSafeOutputStream(OutputStream out) { super(out); outBuffer = new byte[DEFAULT_BUFFER_SIZE]; } | SignSafeOutputStream extends FilterOutputStream { public SignSafeOutputStream(OutputStream out) { super(out); outBuffer = new byte[DEFAULT_BUFFER_SIZE]; } } | SignSafeOutputStream extends FilterOutputStream { public SignSafeOutputStream(OutputStream out) { super(out); outBuffer = new byte[DEFAULT_BUFFER_SIZE]; } SignSafeOutputStream(OutputStream out); } | SignSafeOutputStream extends FilterOutputStream { public SignSafeOutputStream(OutputStream out) { super(out); outBuffer = new byte[DEFAULT_BUFFER_SIZE]; } SignSafeOutputStream(OutputStream out); void encode(byte next); @Override void write(int b); @Override void write(byte[] b, int off, int len); @Override void flush()... | SignSafeOutputStream extends FilterOutputStream { public SignSafeOutputStream(OutputStream out) { super(out); outBuffer = new byte[DEFAULT_BUFFER_SIZE]; } SignSafeOutputStream(OutputStream out); void encode(byte next); @Override void write(int b); @Override void write(byte[] b, int off, int len); @Override void flush()... |
@Test public void stringQuotationShouldCorrectlyQuote() { assertEquals("\"sample\"", Address.quoteString("sample")); assertEquals("\"\"sample\"\"", Address.quoteString("\"\"sample\"\"")); assertEquals("\"sample\"", Address.quoteString("\"sample\"")); assertEquals("\"sa\"mp\"le\"", Address.quoteString("sa\"mp\"le")); as... | @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } | Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } } | Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } Address(Address address); Address(String address, String personal); Address(String address); private Address(String a... | Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } Address(Address address); Address(String address, String personal); Address(String address); private Address(String a... | Address implements Serializable { @VisibleForTesting static String quoteString(String s) { if (s == null) { return null; } if (!s.matches("^\".*\"$")) { return "\"" + s + "\""; } else { return s; } } Address(Address address); Address(String address, String personal); Address(String address); private Address(String a... |
@Test public void decodeUri_withTLSUri_shouldUseStartTls() { ServerSettings settings = Pop3Store.decodeUri("pop3+tls+: assertEquals(settings.connectionSecurity, ConnectionSecurity.STARTTLS_REQUIRED); } | public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new IllegalArgumentException("Inval... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... |
@Test public void decodeUri_withPlainUri_shouldUseNoSecurity() { ServerSettings settings = Pop3Store.decodeUri("pop3: assertEquals(settings.connectionSecurity, ConnectionSecurity.NONE); } | public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new IllegalArgumentException("Inval... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... |
@Test public void decodeUri_withExternalCertificateShouldProvideAlias_shouldUseNoSecurity() { ServerSettings settings = Pop3Store.decodeUri("pop3: assertEquals(settings.clientCertificateAlias, "clientCert"); } | public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new IllegalArgumentException("Inval... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... |
@Test public void shouldStripSignatureAfterLastBlockquoteTags() throws Exception { String html = "<html><head></head><body>" + "This is the body text" + "<br>" + "<blockquote>" + "Some quote" + "</blockquote>" + "<br>" + "-- <br>" + "Sent from my Android device with K-9 Mail. Please excuse my brevity." + "</body></html... | public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } | HtmlSignatureRemover { public static String stripSignature(String content) { return new HtmlSignatureRemover().stripSignatureInternal(content); } static String stripSignature(String content); } |
@Test(expected = IllegalArgumentException.class) public void decodeUri_withNonPop3Uri_shouldThrowException() { Pop3Store.decodeUri("imap: } | public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new IllegalArgumentException("Inval... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... | Pop3Store extends RemoteStore { public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; String username = null; String password = null; String clientCertificateAlias = null; URI pop3Uri; try { pop3Uri = new URI(uri); } catch (URISyntaxException use) { throw new... |
@Test public void createUri_withSSLTLS_required_shouldProduceSSLUri() { ServerSettings settings = new ServerSettings(Type.POP3, "server", 12345, ConnectionSecurity.SSL_TLS_REQUIRED, AuthType.PLAIN, "user", "password", null); String uri = Pop3Store.createUri(settings); assertEquals(uri, "pop3+ssl+: } | public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCertificateAlias) : ""; String sch... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... |
@Test public void createUri_withSTARTTLSRequired_shouldProduceTLSUri() { ServerSettings settings = new ServerSettings(Type.POP3, "server", 12345, ConnectionSecurity.STARTTLS_REQUIRED, AuthType.PLAIN, "user", "password", null); String uri = Pop3Store.createUri(settings); assertEquals(uri, "pop3+tls+: } | public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCertificateAlias) : ""; String sch... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... |
@Test public void createUri_withNONE_shouldProducePop3Uri() { ServerSettings settings = new ServerSettings(Type.POP3, "server", 12345, ConnectionSecurity.NONE, AuthType.PLAIN, "user", "password", null); String uri = Pop3Store.createUri(settings); assertEquals(uri, "pop3: } | public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCertificateAlias) : ""; String sch... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... |
@Test public void createUri_withPLAIN_shouldProducePlainAuthUri() { ServerSettings settings = new ServerSettings(Type.POP3, "server", 12345, ConnectionSecurity.NONE, AuthType.PLAIN, "user", "password", null); String uri = Pop3Store.createUri(settings); assertEquals(uri, "pop3: } | public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCertificateAlias) : ""; String sch... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... |
@Test public void createUri_withEXTERNAL_shouldProduceExternalAuthUri() { ServerSettings settings = new ServerSettings(Type.POP3, "server", 12345, ConnectionSecurity.NONE, AuthType.EXTERNAL, "user", "password", "clientCert"); String uri = Pop3Store.createUri(settings); assertEquals(uri, "pop3: } | public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCertificateAlias) : ""; String sch... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... | Pop3Store extends RemoteStore { public static String createUri(ServerSettings server) { String userEnc = encodeUtf8(server.username); String passwordEnc = (server.password != null) ? encodeUtf8(server.password) : ""; String clientCertificateAliasEnc = (server.clientCertificateAlias != null) ? encodeUtf8(server.clientCe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.