|
|
@ -61,6 +61,9 @@ public class ConferenceServiceTest {
|
|
|
|
@InjectMocks
|
|
|
|
@InjectMocks
|
|
|
|
ConferenceService conferenceService;
|
|
|
|
ConferenceService conferenceService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Integer ID = 1;
|
|
|
|
|
|
|
|
private final Integer ROMOVE_INDEX = 0;
|
|
|
|
|
|
|
|
|
|
|
|
private List<Conference> conferences;
|
|
|
|
private List<Conference> conferences;
|
|
|
|
private List<Deadline> deadlines;
|
|
|
|
private List<Deadline> deadlines;
|
|
|
|
private List<Paper> papers;
|
|
|
|
private List<Paper> papers;
|
|
|
@ -171,20 +174,26 @@ public class ConferenceServiceTest {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void delete() {
|
|
|
|
public void delete() {
|
|
|
|
when(conferenceRepository.exists(1)).thenReturn(true);
|
|
|
|
when(conferenceRepository.exists(ID)).thenReturn(true);
|
|
|
|
assertTrue(conferenceService.delete(1));
|
|
|
|
when(conferenceRepository.findOne(ID)).thenReturn(conferenceWithId);
|
|
|
|
|
|
|
|
assertTrue(conferenceService.delete(ID));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void addDeadline() {
|
|
|
|
public void addDeadline() {
|
|
|
|
ConferenceDto newConferenceDto = conferenceService.addDeadline(conferenceDto);
|
|
|
|
ConferenceDto newConferenceDto = new ConferenceDto();
|
|
|
|
assertEquals(conferenceDto, newConferenceDto);
|
|
|
|
newConferenceDto.getDeadlines().add(new Deadline());
|
|
|
|
|
|
|
|
conferenceDto.getDeadlines().clear();
|
|
|
|
|
|
|
|
assertEquals(newConferenceDto.getDeadlines(), conferenceService.addDeadline(conferenceDto).getDeadlines());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void removeDeadline() throws IOException {
|
|
|
|
public void removeDeadline() throws IOException {
|
|
|
|
ConferenceDto newConferenceDto = conferenceService.removeDeadline(conferenceDto, 0);
|
|
|
|
ConferenceDto newConferenceDto = new ConferenceDto();
|
|
|
|
assertEquals(conferenceDto, newConferenceDto);
|
|
|
|
newConferenceDto.getRemovedDeadlineIds().add(ID);
|
|
|
|
|
|
|
|
ConferenceDto result = conferenceService.removeDeadline(conferenceDto, ROMOVE_INDEX);
|
|
|
|
|
|
|
|
assertEquals(newConferenceDto.getDeadlines(), result.getDeadlines());
|
|
|
|
|
|
|
|
assertEquals(newConferenceDto.getRemovedDeadlineIds(), result.getRemovedDeadlineIds());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -196,7 +205,7 @@ public class ConferenceServiceTest {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void removePaper() throws IOException {
|
|
|
|
public void removePaper() throws IOException {
|
|
|
|
ConferenceDto newConferenceDto = conferenceService.removePaper(conferenceDto, 0);
|
|
|
|
ConferenceDto newConferenceDto = conferenceService.removePaper(conferenceDto, ROMOVE_INDEX);
|
|
|
|
assertEquals(conferenceDto, newConferenceDto);
|
|
|
|
assertEquals(conferenceDto, newConferenceDto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -234,7 +243,7 @@ public class ConferenceServiceTest {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void ping() throws IOException {
|
|
|
|
public void ping() throws IOException {
|
|
|
|
when(conferenceRepository.findOne(1)).thenReturn(conferenceWithId);
|
|
|
|
when(conferenceRepository.findOne(ID)).thenReturn(conferenceWithId);
|
|
|
|
when(conferenceRepository.updatePingConference(1)).thenReturn(1);
|
|
|
|
when(conferenceRepository.updatePingConference(1)).thenReturn(1);
|
|
|
|
assertEquals(1, conferenceService.ping(conferenceDto));
|
|
|
|
assertEquals(1, conferenceService.ping(conferenceDto));
|
|
|
|
}
|
|
|
|
}
|
|
|
|