2929import org .mockito .MockitoAnnotations ;
3030
3131import java .util .Arrays ;
32+ import java .util .Collections ;
3233import java .util .List ;
3334
3435/**
@@ -71,13 +72,13 @@ void testCreateBlockGroups() {
7172
7273 @ Test
7374 void testUpdateBlockGroups () {
74- when (blockGroupService .updateBlockGroupById (any (BlockGroup .class ))).thenReturn (Integer . valueOf ( 0 ) );
75+ when (blockGroupService .updateBlockGroupById (any (BlockGroup .class ))).thenReturn (1 );
7576 BlockGroup blockGroup = new BlockGroup ();
76- when (blockGroupMapper . queryBlockGroupAndBlockById ( anyInt (), null , null )).thenReturn (blockGroup );
77+ when (blockGroupService . findBlockGroupById ( 1 )).thenReturn (blockGroup );
7778
7879 Result <List <BlockGroup >> result =
79- blockGroupController .updateBlockGroups (Integer . valueOf ( 0 ) , new BlockGroup ());
80- Assertions .assertEquals (blockGroup , result .getData (). get ( 0 ));
80+ blockGroupController .updateBlockGroups (1 , new BlockGroup ());
81+ Assertions .assertEquals ("200" , result .getCode ( ));
8182 }
8283
8384 @ Test
@@ -86,9 +87,8 @@ void testDeleteBlockGroups() {
8687 mockData .setId (1 );
8788 when (blockGroupService .findBlockGroupById (anyInt ())).thenReturn (mockData );
8889 when (blockGroupService .deleteBlockGroupById (anyInt ())).thenReturn (Integer .valueOf (0 ));
89- BlockGroup resultData = new BlockGroup ();
9090
9191 Result <List <BlockGroup >> result = blockGroupController .deleteBlockGroups (1 );
92- Assertions .assertEquals (resultData , result .getData (). get ( 0 ));
92+ Assertions .assertEquals ("200" , result .getCode ( ));
9393 }
9494}
0 commit comments