File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
base/src/test/java/com/tinyengine/it/controller Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 1616import static org .mockito .Mockito .when ;
1717
1818import com .tinyengine .it .common .base .Result ;
19+ import com .tinyengine .it .common .context .LoginUserContext ;
1920import com .tinyengine .it .model .entity .User ;
2021import com .tinyengine .it .service .app .UserService ;
2122
3435class UserControllerTest {
3536 @ Mock
3637 private UserService userService ;
38+ @ Mock
39+ private LoginUserContext loginUserContext ;
3740 @ InjectMocks
3841 private UserController userController ;
3942
@@ -46,7 +49,7 @@ void setUp() {
4649 void testMe () {
4750 User mockData = new User ();
4851 when (userService .queryUserById (anyInt ())).thenReturn (mockData );
49-
52+ when ( loginUserContext . getLoginUserId ()). thenReturn ( "1" );
5053 Result <User > result = userController .me ();
5154 Assertions .assertEquals (mockData , result .getData ());
5255 }
You can’t perform that action at this time.
0 commit comments