2222import org .springframework .security .authentication .TestingAuthenticationToken ;
2323import org .springframework .security .core .context .SecurityContext ;
2424import org .springframework .security .core .context .SecurityContextHolder ;
25+ import org .springframework .security .core .context .SecurityContextImpl ;
2526import org .wise .portal .domain .run .Run ;
2627import org .wise .portal .domain .run .impl .RunImpl ;
2728import org .wise .portal .domain .workgroup .Workgroup ;
@@ -35,20 +36,25 @@ public class SurveyAPIControllerTest {
3536 private TestingAuthenticationToken authority ;
3637 private SecurityContext securityContext ;
3738
38- @ TestSubject SurveyAPIController surveyAPIController = new SurveyAPIController ();
39+ @ TestSubject
40+ SurveyAPIController surveyAPIController = new SurveyAPIController ();
3941
40- @ Mock HttpServletResponse httpServletResponse ;
41-
42- @ Mock HttpServletRequest httpServletRequest ;
42+ @ Mock
43+ HttpServletResponse httpServletResponse ;
4344
44- @ Mock RunService runService ;
45+ @ Mock
46+ HttpServletRequest httpServletRequest ;
4547
46- @ Mock WorkgroupService workgroupService ;
48+ @ Mock
49+ RunService runService ;
50+
51+ @ Mock
52+ WorkgroupService workgroupService ;
4753
4854 @ BeforeEach
4955 public void setUp () {
5056 run = new RunImpl ();
51- run .setId (1 );
57+ run .setId (1L );
5258 }
5359
5460 SecurityContext getSecurityContext (String role , String authorityName ) {
@@ -57,6 +63,7 @@ SecurityContext getSecurityContext(String role, String authorityName) {
5763 authority .setAuthenticated (true );
5864 securityContext = new SecurityContextImpl ();
5965 securityContext .setAuthentication (authority );
66+ return securityContext ;
6067 }
6168
6269 @ Test
@@ -124,4 +131,3 @@ public void launchSurveyRun_NoIssues_RedirectUnit() throws Exception {
124131 verify (workgroupService );
125132 }
126133}
127-
0 commit comments