<commit_before>package org.axway.grapes.server.email;

import static org.junit.Assert.*;

import java.util.Properties;

import org.axway.grapes.server.core.services.GrapesEmail;
import org.junit.Test;

public class GrapesEmailTest {

    @Test
    public void validPropertiesTest() {
        Properties mailProperties = new Properties();
        mailProperties.put(GrapesEmail.MAIL_SMTP_HOST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_PORT, "a port");
        mailProperties.put(GrapesEmail.MAIL_SMTP_USER, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_SMTP_PASSWORD, "***");
        mailProperties.put(GrapesEmail.MAIL_SMTP_SSL_TRUST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_FROM, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_DEBUG, true);

        Throwable e = null;
        GrapesEmail grapesEmail = new GrapesEmail();
        try {
            grapesEmail.setup(mailProperties);
        } catch (Throwable ex) {
            e = ex;
        }
        Properties defaultProps = grapesEmail.getSmtpProperties();

        // Checking if all default values are existing
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_STARTTLS_ENABLE));
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_AUTH));
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_PORT));
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_SSL_TRUST));

        // No exception should be thrown as user values are provided
        assertNull(e);

    }

    @Test
    public void invalidPropertiesTest() {
        Properties mailProperties = new Properties();
        mailProperties.put(GrapesEmail.MAIL_SMTP_HOST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_PORT, "a port");
        mailProperties.put(GrapesEmail.MAIL_SMTP_USER, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_SMTP_SSL_TRUST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_FROM, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_DEBUG, true);

        GrapesEmail grapesEmail = new GrapesEmail();
        assertTrue(grapesEmail.setup(mailProperties));
    }<commit_msg>Modifying test cases<commit_after>package org.axway.grapes.server.email;

import static org.junit.Assert.*;

import java.util.Properties;

import org.axway.grapes.server.core.services.GrapesEmail;
import org.junit.Test;

public class GrapesEmailTest {

    @Test
    public void validPropertiesTest() {
        Properties mailProperties = new Properties();
        mailProperties.put(GrapesEmail.MAIL_SMTP_HOST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_PORT, "a port");
        mailProperties.put(GrapesEmail.MAIL_SMTP_USER, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_SMTP_PASSWORD, "***");
        mailProperties.put(GrapesEmail.MAIL_SMTP_SSL_TRUST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_FROM, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_DEBUG, true);

        Throwable e = null;
        GrapesEmail grapesEmail = new GrapesEmail();
        try {
            grapesEmail.setup(mailProperties);
        } catch (Throwable ex) {
            e = ex;
        }
        Properties defaultProps = grapesEmail.getSmtpProperties();

        // Checking if all default values are existing
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_STARTTLS_ENABLE));
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_AUTH));
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_PORT));
        assertTrue(defaultProps.containsKey(GrapesEmail.MAIL_SMTP_SSL_TRUST));

        // No exception should be thrown as user values are provided
        assertNull(e);

    }

    @Test
    public void invalidPropertiesTest() {
        Properties mailProperties = new Properties();
        mailProperties.put(GrapesEmail.MAIL_SMTP_HOST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_PORT, "a port");
        mailProperties.put(GrapesEmail.MAIL_SMTP_USER, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_SMTP_SSL_TRUST, "a host");
        mailProperties.put(GrapesEmail.MAIL_SMTP_FROM, "<EMAIL>");
        mailProperties.put(GrapesEmail.MAIL_DEBUG, true);

        GrapesEmail grapesEmail = new GrapesEmail();
        assertFalse(grapesEmail.setup(mailProperties));
    }
{'fraction_non_alphanumeric': 0.10308329498389324, 'fraction_numerical': 0.0, 'mean_word_length': 3.514018691588785, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7060975', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1364, 'n_words': 212}