<commit_before>//package com.example.moodly;
//
//import android.test.ActivityInstrumentationTestCase2;
//
//import java.util.ArrayList;
//import java.util.Date;
//
///**
// * Created by mliew on 2017-02-25.
// */
//
//public class MoodTest extends ActivityInstrumentationTestCase2 {
//    public MoodTest() {
//        super(MoodHolder.class);
//    }
//
//    MoodController con = MoodController.getInstance();
//    ArrayList<Mood> moodList = con.moodList;
//
//    public void testAddMood() {
//        Mood mood = new Mood();
//        Emotion emotion = Emotion.HAPPINESS;
//        String owner = "Harambe";
//        String trigger = "Banana";
//        String reasonText = "Ate a banana";
//        mood.setOwner(owner);
//        mood.setTrigger(trigger);
//        mood.setReasonText(reasonText);
//        mood.setEmotion(emotion);
//        con.addMood(mood);
//        assertTrue(moodList.contains(mood));
//    }
//
//    public void testChooseEmotionalState() {
//        Mood mood = new Mood();
//        Emotion emotion = Emotion.HAPPINESS;
//        mood.setEmotion(emotion);
//        con.addMood(mood);
//        assertEquals(moodList.get(moodList.size() - 1).getEmotion(), emotion);
//    }
//
//    public void testAddTextReason() {
//        Mood mood = new Mood();
//        String textReason = "Happy";
//        mood.setReasonText(textReason);
//        con.addMood(mood);
//        assertEquals(moodList.get(moodList.size() - 1).getReasonText(), textReason);
//    }
//
//    public void testAddLocation() {
//        Mood mood = new Mood();
//        String location = "Cincinnatti";
//        mood.setLocation(location);
//        con.addMood(mood);
//        assertEquals(con.getLocation(moodList.size() - 1), location);
//    }
//
//
//    public void testViewMoodDetails() {
//        Mood mood = new Mood();
//        Emotion emotion = Emotion.ANGER;
//        String owner = "Harambe";
//        String trigger = "Banana";
//        String reasonText = "Ate a banana";
//        mood.setOwner(owner);
//        mood.setEmotion(emotion);
//        mood.setTrigger(trigger);
//        mood.setReasonText(reasonText);
//        con.addMood(mood);
//        assertEquals(emotion, moodList.get(moodList.size() - 1).getEmotion());
//        assertEquals(trigger, moodList.get(moodList.size() - 1).getTrigger());
//        assertEquals(reasonText, moodList.get(moodList.size() - 1).getReasonText());
//    }
//
//    public void testEditMood() {
//        Mood mood = new Mood();
//        Mood newMood = new Mood();
//
//        Emotion emotion = Emotion.ANGER;
//        String owner = "Harambe";
//        String trigger = "Banana";
//        String reasonText = "Ate a banana";
//
//        mood.setOwner(owner);
//        mood.setEmotion(emotion);
//        mood.setTrigger(trigger);
//        mood.setReasonText(reasonText);
//
//        con.addMood(mood);
//
//        String newTrigger = "a kid";
//        newMood.setEmotion(emotion);
//        newMood.setOwner(owner);
//        newMood.setTrigger(newTrigger);
//        newMood.setReasonText(reasonText);
//
//        con.editMood(0, newMood);
//
//        assertEquals(emotion, moodList.get(0).getEmotion());
//        assertEquals(newTrigger, moodList.get(0).getTrigger());
//        assertEquals(reasonText, moodList.get(0).getReasonText());
//    }
//
//    public void testDeleteMood() {
//        Mood mood = new Mood();
//        Emotion emotion = Emotion.ANGER;
//        String owner = "Harambe";
//        String trigger = "Kid fell down";
//        String reasonText = "Some1 shot me";
//
//        mood.setOwner(owner);
//        mood.setEmotion(emotion);
//        mood.setTrigger(trigger);
//        mood.setReasonText(reasonText);
//
//        con.addMood(mood);
//        con.deleteMood(moodList.size() - 1);
//        assertFalse(moodList.contains(mood));
//    }
//
//    public void testFilter() {
//        //TODO test filterByDate
//        Mood mood = new Mood();
//        Emotion emotion = Emotion.ANGER;
//        String reason = "not happy";
//        mood.setEmotion(emotion);
//        mood.setReasonText(reason);
//        con.addMood(mood);
//
//        Mood anotherMood = new Mood();
//        Emotion newEmotion = Emotion.CONFUSION;
//        String newReason = "cant understand";
//        anotherMood.setReasonText(newReason);
//        anotherMood.setEmotion(newEmotion);
//        con.addMood(anotherMood);
//
//        ArrayList<Mood> result = con.filterByEmoState(Emotion.ANGER);
//        assertEquals(result.get(0), mood);
//
//        result = con.filterByTextReason("understand");
//        assertEquals(result.get(0), anotherMood);
//    }
//
//}<commit_msg>Unit Testing with Enum to int emotion<commit_after>package com.example.moodly;

import android.test.ActivityInstrumentationTestCase2;

import com.example.moodly.Adapters.MoodHolder;
import com.example.moodly.Controllers.MoodController;
import com.example.moodly.Models.Emotion;
import com.example.moodly.Models.Mood;

import java.util.ArrayList;
import java.util.Date;

/**
 * Created by mliew on 2017-02-25.
 */

public class MoodTest extends ActivityInstrumentationTestCase2 {
    public MoodTest() {
        super(MoodHolder.class);
    }

    MoodController con = MoodController.getInstance();
    ArrayList<Mood> moodList = con.moodHistoryList;

    public void testAddMood() {
        Mood mood = new Mood();
        Emotion emotion = Emotion.HAPPINESS;
        String owner = "Harambe";
        String trigger = "Banana";
        String reasonText = "Ate a banana";
        mood.setOwner(owner);
        mood.setTrigger(trigger);
        mood.setReasonText(reasonText);
        mood.setEmotion(emotion.ordinal());
        con.addMood(-1,mood);
        moodList = con.moodHistoryList;
        assertTrue(moodList.contains(mood));
    }

    public void testChooseEmotionalState() {
        Mood mood = new Mood();
        Emotion emotion;
        emotion = Emotion.HAPPINESS;
        mood.setEmotion(emotion.ordinal());
        con.addMood(-1,mood);
        moodList = con.moodHistoryList;
        assertEquals(moodList.get(moodList.size() - 1).getEmotion(), emotion.ordinal());
    }

    public void testAddTextReason() {
        Mood mood = new Mood();
        String textReason = "Happy";
        mood.setReasonText(textReason);
        con.addMood(-1,mood);
        moodList = con.moodHistoryList;
        assertEquals(moodList.get(moodList.size() - 1).getReasonText(), textReason);
    }

//    public void testAddLocation() {
//        Mood mood = new Mood();
//        String location = "Cincinnatti";
//        mood.setLocation(location);
//        con.addMood(mood);
//        assertEquals(con.getLocation(moodList.size() - 1), location);
//    }


    public void testViewMoodDetails() {
        Mood mood = new Mood();
        Emotion emotion = Emotion.ANGER;
        String owner = "Harambe";
        String trigger = "Banana";
        String reasonText = "Ate a banana";
        mood.setOwner(owner);
        mood.setEmotion(emotion.ordinal());
        mood.setTrigger(trigger);
        mood.setReasonText(reasonText);
        con.addMood(-1,mood);
        moodList = con.moodHistoryList;
        assertEquals(emotion.ordinal(), moodList.get(moodList.size() - 1).getEmotion());
        assertEquals(trigger, moodList.get(moodList.size() - 1).getTrigger());
        assertEquals(reasonText, moodList.get(moodList.size() - 1).getReasonText());
    }

    public void testEditMood() {
        Mood mood = new Mood();
        Mood newMood = new Mood();

        Emotion emotion = Emotion.ANGER;
        String owner = "Harambe";
        String trigger = "Banana";
        String reasonText = "Ate a banana";

        mood.setOwner(owner);
        mood.setEmotion(emotion.ordinal());
        mood.setTrigger(trigger);
        mood.setReasonText(reasonText);

        con.addMood(-1,mood);
        moodList = con.moodHistoryList;

        String newTrigger = "a kid";
        newMood.setEmotion(emotion.ordinal());
        newMood.setOwner(owner);
        newMood.setTrigger(newTrigger);
        newMood.setReasonText(reasonText);

        con.addMood(0, newMood);

        assertEquals(emotion.ordinal(), moodList.get(0).getEmotion());
        assertEquals(newTrigger, moodList.get(0).getTrigger());
        assertEquals(reasonText, moodList.get(0).getReasonText());
    }

    public void testDeleteMood() {
        Mood mood = new Mood();
        Emotion emotion = Emotion.ANGER;
        String owner = "Harambe";
        String trigger = "Kid fell down";
        String reasonText = "Someone shot me";

        mood.setOwner(owner);
        mood.setEmotion(emotion.ordinal());
        mood.setTrigger(trigger);
        mood.setReasonText(reasonText);
        moodList = con.moodHistoryList;
        con.addMood(-1,mood);
        con.deleteMood(moodList.size() - 1);
        assertFalse(moodList.contains(mood));
    }
//
//    public void testFilter() {
//        //TODO test filterByDate
//        Mood mood = new Mood();
//        Emotion emotion = Emotion.ANGER;
//        String reason = "not happy";
//        mood.setEmotion(emotion);
//        mood.setReasonText(reason);
//        con.addMood(mood);
//
//        Mood anotherMood = new Mood();
//        Emotion newEmotion = Emotion.CONFUSION;
//        String newReason = "cant understand";
//        anotherMood.setReasonText(newReason);
//        anotherMood.setEmotion(newEmotion);
//        con.addMood(anotherMood);
//
//        ArrayList<Mood> result = con.filterByEmoState(Emotion.ANGER);
//        assertEquals(result.get(0), mood);
//
//        result = con.filterByTextReason("understand");
//        assertEquals(result.get(0), anotherMood);
//    }
//
}
{'fraction_non_alphanumeric': 0.1500359675264618, 'fraction_numerical': 0.005446511149933203, 'mean_word_length': 2.286727456940223, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4737287', 'n_tokens_mistral': 3098, 'n_tokens_neox': 3052, 'n_words': 535}