package at.ac.tuwien.inso.dto_tests;

import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.junit.Assert.*;

import org.junit.Test;

import at.ac.tuwien.inso.dto.SemesterDto;
import at.ac.tuwien.inso.entity.SemesterType;

@RunWith(MockitoJUnitRunner.class)
public class SemesterDtoTests {

	private SemesterDto getWS2016WithoutId() {
		return new SemesterDto(2016, SemesterType.WinterSemester);
	}

	private SemesterDto getWS2016(){
		SemesterDto a = getWS2016WithoutId();
		a.setId(1L);
		return a;
	}
	
	private SemesterDto getSS2015(){
		SemesterDto b = new SemesterDto(2015, SemesterType.SummerSemester);
		b.setId(2L);
		return b;
	}

	
	@Test
	public void testEquals() {
		assertTrue(getWS2016().equals(getWS2016()));
	}
	
	@Test
	public void testEqualsDifferntValues() {
		assertFalse(getWS2016().equals(getSS2015()));
	}
	
	@Test
	public void testEqualsNoId() {
		assertFalse(getWS2016().equals(getWS2016WithoutId()));
	}
}

@@ -171,16 +171,80 @@
 .Test;%0A%0A
+import java.util.Calendar;%0Aimport java.util.GregorianCalendar;%0A%0A
 import a
@@ -1032,10 +1032,2031 @@
 )));%0A%09%7D%0A
+%0A%09@Test%0A%09public void testIsStartInPast() %7B%0A        Calendar before = new GregorianCalendar(2000, 1, 1);%0A        Calendar after = new GregorianCalendar(2020, 3, 3);%0A%0A        SemesterDto semester = new SemesterDto(2010, SemesterType.SummerSemester);%0A%0A        assertFalse(semester.isStartInPast(before));%0A        assertTrue(semester.isStartInPast(after));%0A    %7D%0A%0A%09@Test%0A%09public void testCalculateCurrentSemesterSS() %7B%0A%09%09Calendar currentDay = new GregorianCalendar(2016, 06, 06);%0A%0A%09%09SemesterDto expected = new SemesterDto(2016, SemesterType.SummerSemester);%0A%0A%09%09SemesterDto actual = SemesterDto.calculateCurrentSemester(currentDay);%0A%0A%09%09assertEquals(expected, actual);%0A%09%7D%0A%0A%09@Test%0A%09public void testCalculateCurrentSemesterWS() %7B%0A%09%09Calendar currentDay = new GregorianCalendar(2000, 01, 07);%0A%0A%09%09SemesterDto expected = new SemesterDto(1999, SemesterType.WinterSemester);%0A%0A%09%09SemesterDto actual = SemesterDto.calculateCurrentSemester(currentDay);%0A%0A%09%09assertEquals(expected, actual);%0A%09%7D%0A%0A    @Test%0A    public void testIsCurrent() %7B%0A        Calendar now = new GregorianCalendar(2016, 1, 1);%0A%0A        SemesterDto semester = new SemesterDto(2015, SemesterType.WinterSemester);%0A%0A        assertTrue(semester.isCurrent(now));%0A    %7D%0A%0A    @Test%0A    public void testNotIsCurrent() %7B%0A        Calendar now = new GregorianCalendar(2000, 7, 7);%0A%0A        SemesterDto semester = new SemesterDto(2000, SemesterType.WinterSemester);%0A%0A        assertFalse(semester.isCurrent(now));%0A    %7D%0A%0A    @Test%0A    public void testNotIsCurrentOtherYear() %7B%0A        Calendar now = new GregorianCalendar(2000, 7, 7);%0A%0A        SemesterDto semester = new SemesterDto(2010, SemesterType.SummerSemester);%0A%0A        assertFalse(semester.isCurrent(now));%0A    %7D%0A%0A    @Test%0A    public void testNextPossibleSemester() %7B%0A%09    SemesterDto semester = new SemesterDto(2016, SemesterType.WinterSemester);%0A%0A%09    SemesterDto expected = new SemesterDto(2017, SemesterType.SummerSemester);%0A%0A%09    SemesterDto actual = semester.nextSemester();%0A%0A%09    assertEquals(expected, actual);%0A    %7D%0A%0A
 %7D%0A

Test new methods