package nerd.tuxmobil.fahrplan.congress.utils;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(JUnit4.class)
public class ConferenceTimeFrameTest {

    // 2015-12-27T00:00:00+0100, in seconds: 1451170800000
    final long FIRST_DAY_START_TIME = 1451170800000L;

    // 2015-12-31T00:00:00+0100, in seconds: 1451516400000
    final long LAST_DAY_END_TIME = 1451516400000L;

    private ConferenceTimeFrame conference;

    @Before
    public void setUp() throws Exception {
        conference = new ConferenceTimeFrame(FIRST_DAY_START_TIME, LAST_DAY_END_TIME);
    }

    @Test
    public void getFirstDayStart() throws Exception {
        assertThat(conference.getFirstDayStartTime()).isEqualTo(FIRST_DAY_START_TIME);
    }

    @Test
    public void containsWithTimeWithFirstDayEvent() throws Exception {
        // 2015-12-27T11:30:00+0100, in seconds: 1451212200000
        assertThat(conference.contains(1451212200000L)).isTrue();
    }

    @Test
    public void containsWithOneSecondBeforeFirstDay() throws Exception {
        // 2015-12-26T23:59:59+0100, in seconds: 1451170799000
        assertThat(conference.contains(1451170799000L)).isFalse();
    }

    @Test
    public void containsWithTimeOfLastDay() throws Exception {
        assertThat(conference.contains(LAST_DAY_END_TIME)).isFalse();
    }

    @Test
    public void endsBeforeWithTimeOfLastDay() throws Exception {
        assertThat(conference.endsBefore(LAST_DAY_END_TIME)).isTrue();
    }

    @Test
    public void endsBeforeWithTimeBeforeLastDay() throws Exception {
        assertThat(conference.endsBefore(LAST_DAY_END_TIME - 1)).isFalse();
    }

    @Test
    public void startsAfterWithTimeOfFirstDay() throws Exception {
        assertThat(conference.startsAfter(FIRST_DAY_START_TIME)).isFalse();
    }

    @Test
    public void startsAfterWithTimeBeforeFirstDay() throws Exception {
        assertThat(conference.startsAfter(FIRST_DAY_START_TIME - 1)).isTrue();
    }

    @Test
    public void startsAtOrBeforeWithTimeOfFirstDay() throws Exception {
        assertThat(conference.startsAtOrBefore(FIRST_DAY_START_TIME)).isTrue();
    }

    @Test
    public void startsAtOrBeforeWithTimeAfterFirstDay() throws Exception {
        assertThat(conference.startsAtOrBefore(FIRST_DAY_START_TIME + 1)).isTrue();
    }

    @Test
    public void startsAtOrBeforeWithTimeBeforeFirstDay() throws Exception {
        assertThat(conference.startsAtOrBefore(FIRST_DAY_START_TIME - 1)).isFalse();
    }

}

@@ -333,32 +333,47 @@
 51170800000%0A    
+private static 
 final long FIRST
@@ -470,16 +470,31 @@
 000%0A    
+private static 
 final lo
@@ -613,33 +613,16 @@
  setUp()
- throws Exception
  %7B%0A     
@@ -754,33 +754,16 @@
 yStart()
- throws Exception
  %7B%0A     
@@ -912,33 +912,16 @@
 yEvent()
- throws Exception
  %7B%0A     
@@ -1114,33 +1114,16 @@
 rstDay()
- throws Exception
  %7B%0A     
@@ -1307,33 +1307,16 @@
 astDay()
- throws Exception
  %7B%0A     
@@ -1442,33 +1442,16 @@
 astDay()
- throws Exception
  %7B%0A     
@@ -1582,33 +1582,16 @@
 astDay()
- throws Exception
  %7B%0A     
@@ -1725,33 +1725,16 @@
 rstDay()
- throws Exception
  %7B%0A     
@@ -1872,33 +1872,16 @@
 rstDay()
- throws Exception
  %7B%0A     
@@ -2023,33 +2023,16 @@
 rstDay()
- throws Exception
  %7B%0A     
@@ -2178,33 +2178,16 @@
 rstDay()
- throws Exception
  %7B%0A     
@@ -2342,25 +2342,8 @@
 ay()
- throws Exception
  %7B%0A 

Resolve Lint warnings.