From e6cb991463b4a6d0eb549d6dc9418b63b5fc97e0 Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Tue, 14 May 2019 17:54:18 +0400 Subject: [PATCH] #104 test is member --- .../module_test/ConferenceServiceTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/java/conference/module_test/ConferenceServiceTest.java b/src/test/java/conference/module_test/ConferenceServiceTest.java index 87a77a8..1e8f306 100644 --- a/src/test/java/conference/module_test/ConferenceServiceTest.java +++ b/src/test/java/conference/module_test/ConferenceServiceTest.java @@ -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)); + } }