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 testCommentTooLong() {
        String testComment = "this is a test comment that is more than 30 characters long";
        assertTrue(testComment.length() > 30);
        try {
            event.setComment(testComment);
            fail("Exception was not thrown for a comment that is too long");
        } catch (CommentTooLongException e) {

        }
    }

    @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");
    }

}
@@ -1470,18 +1470,19 @@
 oid 
-ge
+tes
 tPicture
 () t
@@ -1469,32 +1469,37 @@
 void testPicture
+Class
 () throws Except
@@ -1516,128 +1516,106 @@
     
-fail(%22not implemented%22
+event.setPicture(new Picture()
 );%0A    
-%7D%0A%0A
     
-@Test%0A    public void setPicture() throws Exception %7B%0A        fail(%22not implemented%22
+assertEquals(event.getPicture().getClass(), Picture.class
 );%0A 
@@ -1863,18 +1863,19 @@
 ic void 
-ge
+tes
 tLocatio
@@ -1867,32 +1867,37 @@
 oid testLocation
+Class
 () throws Except
@@ -1914,129 +1914,116 @@
     
-fail(%22not implemented
+event.setLocation(new Location(%22test
 %22)
+)
 ;%0A    
-%7D%0A%0A
     
-@Test%0A    public void setLocation() throws Exception %7B%0A        fail(%22not implemented%22
+assertEquals(event.getLocation().getClass(), Location.class
 );%0A 

add tests for getter and setter of Location and Picture