@Test
  public void testGetFolder() throws MessagingException {
    Properties props;
    Session session;
    Folder folder;
    props = new Properties();

    props.put("mail.host", "pop.gmail.com");
    props.put("mail.store.protocol", "pop3s");
    props.put("mail.pop3s.auth", "true");
    props.put("mail.pop3s.port", 995);

    session = Session.getInstance(props, null);
    Store instance;

    // with wrong param
    instance = session.getStore();
    instance.connect("*****@*****.**", "spamreturn");
    try {
      folder = instance.getFolder("");
    } catch (MessagingException ex) {
      assertTrue(true);
    }

    // with valid param
    try {
      folder = instance.getFolder("INBOX");
      assertTrue(true);
    } catch (MessagingException ex) {
      fail("Should not throw MessagingException");
    }
  }
  @Test
  public void testConnect() throws MessagingException {
    Properties props;
    Session session;
    Folder folder;
    props = new Properties();

    props.put("mail.host", "smtp.unice.fr");
    props.put("mail.store.protocol", "pop3s");
    props.put("mail.pop3s.auth", "true");
    props.put("mail.pop3s.port", 25);

    session = Session.getInstance(props, null);
    Store instance;
    try {
      instance = session.getStore();
      instance.connect(null, null);
      fail("Should throw MessagingException : params are null.");
    } catch (NoSuchProviderException ex) {
      throw ex; // this exception should not be thrown to test connect method
    } catch (MessagingException ex) {
      assertTrue(true);
    }
  }