package com.stylepoints.habittracker;

import android.graphics.Picture;
import android.location.Location;

import org.junit.Before;
import org.junit.Test;

import java.util.Date;
import java.util.GregorianCalendar;

import static org.junit.Assert.*;

/**
 * Created by mchauck on 10/21/17.
 */
public class HabitEventTest {
    HabitEvent event;

    @Before
    public void setUp() throws Exception {
        try {
            event = new HabitEvent("test comment");
        } catch (CommentTooLongException e) {
            fail("HabitEvent comment too long in setUp()");
        }
    }

    @Test
    public void getComment() throws Exception {
        assertEquals("test comment", event.getComment());
    }

    @Test
    public void setComment() throws Exception {
        assertEquals("test comment", event.getComment());
        try {
            event.setComment("new comment");
        } catch (CommentTooLongException e) {
            fail("new comment is too long to set");
        }
        assertEquals("new comment", event.getComment());
    }

    @Test
    public void getPicture() throws Exception {
        fail("not implemented");
    }

    @Test
    public void setPicture() throws Exception {
        fail("not implemented");
    }

    @Test
    public void dateGetAndSet() throws Exception {
        Date date = new GregorianCalendar(2017, 1, 1).getTime();
        event.setEventDate(date);
        assertEquals(date, event.getEventDate());
    }

    @Test
    public void getLocation() throws Exception {
        fail("not implemented");
    }

    @Test
    public void setLocation() throws Exception {
        fail("not implemented");
    }

}
@@ -1046,32 +1046,418 @@
 ment());%0A    %7D%0A%0A
+    @Test%0A    public void testCommentTooLong() %7B%0A        String testComment = %22this is a test comment that is more than 30 characters long%22;%0A        assertTrue(testComment.length() %3E 30);%0A        try %7B%0A            event.setComment(testComment);%0A            fail(%22Exception was not thrown for a comment that is too long%22);%0A        %7D catch (CommentTooLongException e) %7B%0A%0A        %7D%0A    %7D%0A%0A
     @Test%0A    pu

add test to make sure CommentTooLongException is thrown when comment is more than 30 char