#104 test is member

This commit is contained in:
Nightblade73 2019-05-14 17:54:18 +04:00
parent a8d987b01f
commit e6cb991463

View File

@ -18,6 +18,7 @@ import ru.ulstu.deadline.service.DeadlineService;
import ru.ulstu.paper.model.Paper;
import ru.ulstu.paper.service.PaperService;
import ru.ulstu.user.model.User;
import ru.ulstu.user.service.UserService;
import java.io.IOException;
import java.util.ArrayList;
@ -42,6 +43,9 @@ public class ConferenceServiceTest {
@Mock
PaperService paperService;
@Mock
UserService userService;
@InjectMocks
ConferenceService conferenceService;
@ -57,6 +61,7 @@ public class ConferenceServiceTest {
private Deadline deadline;
private ConferenceDto conferenceDto;
private User user;
@Before
public void setUp() throws Exception {
@ -85,7 +90,7 @@ public class ConferenceServiceTest {
conferenceUser = new ConferenceUser();
conferenceUser.setDeposit(ConferenceUser.Deposit.ARTICLE);
conferenceUser.setParticipation(ConferenceUser.Participation.INTRAMURAL);
User user = new User();
user = new User();
user.setFirstName("Name");
conferenceUser.setUser(user);
@ -115,4 +120,9 @@ public class ConferenceServiceTest {
assertEquals(conference, conferenceService.copyFromDto(new Conference(), conferenceDto));
}
@Test
public void testIsCurrentUserParticipant() throws IOException {
when(userService.getCurrentUser()).thenReturn(user);
assertEquals(true, conferenceService.isCurrentUserParticipant(conferenceUsers));
}
}