@Test public void testConfigureStoreWithTLS() throws Exception { GetMailInput input = inputBuilder.build(); doReturn(objectMock).when(propertiesMock) .setProperty(String.format(PropNames.MAIL_SSL_ENABLE, Constants.POP3), String.valueOf(false)); doReturn(objectMock).when(propertiesMock) .setProperty(String.format(PropNames.MAIL_STARTTLS_ENABLE, Constants.POP3), String.valueOf(true)); doReturn(objectMock).when(propertiesMock) .setProperty(String.format(PropNames.MAIL_STARTTLS_REQUIRED, Constants.POP3), String.valueOf(true)); PowerMockito.mockStatic(Session.class); PowerMockito.doReturn(sessionMock).when(Session.class, "getInstance", Matchers.<Properties>any(), Matchers.<Authenticator>any()); doReturn(storeMock).when(sessionMock).getStore(any(String.class)); Store store = SSLUtils.configureStoreWithTLS(propertiesMock, authenticatorMock, input); assertEquals(storeMock, store); verify(propertiesMock).setProperty(String.format(PropNames.MAIL_SSL_ENABLE, Constants.POP3), String.valueOf(false)); verify(propertiesMock).setProperty(String.format(PropNames.MAIL_STARTTLS_ENABLE, Constants.POP3), String.valueOf(true)); verify(propertiesMock).setProperty(String.format(PropNames.MAIL_STARTTLS_REQUIRED, Constants.POP3), String.valueOf(true)); PowerMockito.verifyStatic(); Session.getInstance(Matchers.<Properties>any(), Matchers.<Authenticator>any()); verify(sessionMock).getStore(Constants.POP3); }
public static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input) throws NoSuchProviderException { configureWithTLS(props, input); Session session = Session.getInstance(props, auth); return session.getStore(input.getProtocol()); }
SSLUtils { public static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input) throws NoSuchProviderException { configureWithTLS(props, input); Session session = Session.getInstance(props, auth); return session.getStore(input.getProtocol()); } }
SSLUtils { public static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input) throws NoSuchProviderException { configureWithTLS(props, input); Session session = Session.getInstance(props, auth); return session.getStore(input.getProtocol()); }  }
SSLUtils { public static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input) throws NoSuchProviderException { configureWithTLS(props, input); Session session = Session.getInstance(props, auth); return session.getStore(input.getProtocol()); }  static KeyStore createKeyStore(final URL url, final String password); static KeyManager[] createKeyManagers(final KeyStore keystore, final String password); static TrustManager[] createAuthTrustManagers(final KeyStore keystore); static Store createMessageStore(GetMailInput input); static void addSSLSettings(boolean trustAllRoots, String keystore,
                                      String keystorePassword, String trustKeystore, String trustPassword); static Store configureStoreWithSSL(Properties props, Authenticator auth, MailInput input); static Store tryTLSOtherwiseTrySSL(Authenticator auth, Properties props, GetMailInput input); static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input); static void configureWithTLS(Properties props, final MailInput input); static void clearTLSProperties(Properties props, MailInput input); }
SSLUtils { public static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input) throws NoSuchProviderException { configureWithTLS(props, input); Session session = Session.getInstance(props, auth); return session.getStore(input.getProtocol()); }  static KeyStore createKeyStore(final URL url, final String password); static KeyManager[] createKeyManagers(final KeyStore keystore, final String password); static TrustManager[] createAuthTrustManagers(final KeyStore keystore); static Store createMessageStore(GetMailInput input); static void addSSLSettings(boolean trustAllRoots, String keystore,
                                      String keystorePassword, String trustKeystore, String trustPassword); static Store configureStoreWithSSL(Properties props, Authenticator auth, MailInput input); static Store tryTLSOtherwiseTrySSL(Authenticator auth, Properties props, GetMailInput input); static Store configureStoreWithTLS(Properties props, Authenticator auth, MailInput input); static void configureWithTLS(Properties props, final MailInput input); static void clearTLSProperties(Properties props, MailInput input);  }