#104 test find one dto

This commit is contained in:
Nightblade73 2019-05-14 18:20:01 +04:00
parent 1c5c05b5e4
commit c88c77cd7d
3 changed files with 33 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import static ru.ulstu.core.util.StreamApiUtils.convert;
@ -218,4 +219,30 @@ public class ConferenceDto {
return BEGIN_DATE + beginDate.toString().split(" ")[0] + " " + END_DATE + endDate.toString().split(" ")[0];
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConferenceDto that = (ConferenceDto) o;
return ping == that.ping &&
disabledTakePart == that.disabledTakePart &&
Objects.equals(id, that.id) &&
Objects.equals(title, that.title) &&
Objects.equals(description, that.description) &&
Objects.equals(url, that.url) &&
Objects.equals(beginDate, that.beginDate) &&
Objects.equals(endDate, that.endDate) &&
Objects.equals(deadlines, that.deadlines) &&
Objects.equals(removedDeadlineIds, that.removedDeadlineIds) &&
Objects.equals(userIds, that.userIds) &&
Objects.equals(paperIds, that.paperIds) &&
Objects.equals(papers, that.papers) &&
Objects.equals(notSelectedPapers, that.notSelectedPapers) &&
Objects.equals(users, that.users);
}
@Override
public int hashCode() {
return Objects.hash(id, title, description, url, ping, beginDate, endDate, deadlines, removedDeadlineIds, userIds, paperIds, papers, notSelectedPapers, users, disabledTakePart);
}
}

View File

@ -149,7 +149,6 @@ public class ConferenceService {
Paper paper = new Paper();
paper.setTitle(userService.getCurrentUser().getLastName() + "_" + conferenceDto.getTitle() + "_" + (new Date()).getTime());
paper.setStatus(Paper.PaperStatus.DRAFT);
conferenceDto.getPapers().add(paper);
}

View File

@ -133,4 +133,10 @@ public class ConferenceServiceTest {
conferenceService.takePart(newConferenceDto);
assertEquals(newConferenceDto.getUsers(), conferenceDto.getUsers());
}
@Test
public void testFindOneDto() throws IOException {
when(conferenceRepository.findOne(1)).thenReturn(conference);
assertEquals(conferenceDto, conferenceService.findOneDto(1));
}
}