package org.itevents.mapper;

import org.itevents.model.Event;
import org.itevents.model.User;
import org.itevents.model.VisitLog;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;

import static org.junit.Assert.assertEquals;

/**
 * Created by vaa25 on 21.07.2015.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/applicationContext.xml"})
public class VisitLogMapperTest {

    @Autowired
    private VisitLogMapper visitLogMapper;

    @Autowired
    private EventMapper eventMapper;
    private final Event event1 = eventMapper.getEvent(1);
    @Autowired
    private UserMapper userMapper;
    private final User user1 = userMapper.getUser(1);

    @Before
    public void addVisit11() {
        visitLogMapper.addVisit(event1, user1);
    }

    @After
    public void deleteVisits() {
        visitLogMapper.removeVisits();
    }

    @Test
    @Ignore
    public void testGetVisit() throws Exception {
        VisitLog visitLog = new VisitLog(event1, new GregorianCalendar().getTime(), user1);
        List<VisitLog> expected = new ArrayList<>();
        expected.add(visitLog);
        List<VisitLog> real = visitLogMapper.getVisitsByEvent(event1);
//        real.setDate(null);
        assertEquals(expected, real);

    }


}

@@ -177,33 +177,8 @@
 re;%0A
-import org.junit.Ignore;%0A
 impo
@@ -865,22 +865,16 @@
 private 
-final 
 Event ev
@@ -881,35 +881,10 @@
 ent1
- = eventMapper.getEvent(1)
 ;
+%0A
 %0A   
@@ -946,14 +946,8 @@
 ate 
-final 
 User
@@ -956,33 +956,10 @@
 ser1
- = userMapper.getUser(1)
 ;
+%0A
 %0A%0A  
@@ -995,24 +995,105 @@
 Visit11() %7B%0A
+        event1 = eventMapper.getEvent(1);%0A        user1 = userMapper.getUser(1);%0A
         visi
@@ -1235,16 +1235,18 @@
   @Test%0A
+//
     @Ign

fix VisitLogMapperTest to runnable