18
18
19
19
import com .tinyengine .it .common .base .Result ;
20
20
import com .tinyengine .it .mapper .BlockGroupMapper ;
21
- import com .tinyengine .it .model .dto .BlockGroupDto ;
22
21
import com .tinyengine .it .model .entity .BlockGroup ;
23
22
import com .tinyengine .it .service .material .BlockGroupService ;
24
23
30
29
import org .mockito .MockitoAnnotations ;
31
30
32
31
import java .util .Arrays ;
32
+ import java .util .Collections ;
33
33
import java .util .List ;
34
34
35
35
/**
@@ -64,21 +64,21 @@ void testGetAllBlockGroups() {
64
64
65
65
@ Test
66
66
void testCreateBlockGroups () {
67
- when (blockGroupService .createBlockGroup (any (BlockGroup .class ))).thenReturn (new Result <List <BlockGroupDto >>());
67
+ when (blockGroupService .createBlockGroup (any (BlockGroup .class ))).thenReturn (new Result <List <BlockGroup >>());
68
68
69
- Result <List <BlockGroupDto >> result = blockGroupController .createBlockGroups (new BlockGroup ());
70
- Assertions .assertEquals (new Result <List <BlockGroupDto >>(), result );
69
+ Result <List <BlockGroup >> result = blockGroupController .createBlockGroups (new BlockGroup ());
70
+ Assertions .assertEquals (new Result <List <BlockGroup >>(), result );
71
71
}
72
72
73
73
@ Test
74
74
void testUpdateBlockGroups () {
75
- when (blockGroupService .updateBlockGroupById (any (BlockGroup .class ))).thenReturn (Integer . valueOf ( 0 ) );
76
- BlockGroupDto blockGroupDto = new BlockGroupDto ();
77
- when (blockGroupMapper . getBlockGroupsById ( anyInt ())) .thenReturn (Arrays .< BlockGroupDto > asList ( blockGroupDto ) );
75
+ when (blockGroupService .updateBlockGroupById (any (BlockGroup .class ))).thenReturn (1 );
76
+ BlockGroup blockGroup = new BlockGroup ();
77
+ when (blockGroupService . findBlockGroupById ( 1 )) .thenReturn (blockGroup );
78
78
79
- Result <List <BlockGroupDto >> result =
80
- blockGroupController .updateBlockGroups (Integer . valueOf ( 0 ) , new BlockGroup ());
81
- Assertions .assertEquals (blockGroupDto , result .getData (). get ( 0 ));
79
+ Result <List <BlockGroup >> result =
80
+ blockGroupController .updateBlockGroups (1 , new BlockGroup ());
81
+ Assertions .assertEquals ("200" , result .getCode ( ));
82
82
}
83
83
84
84
@ Test
@@ -87,10 +87,8 @@ void testDeleteBlockGroups() {
87
87
mockData .setId (1 );
88
88
when (blockGroupService .findBlockGroupById (anyInt ())).thenReturn (mockData );
89
89
when (blockGroupService .deleteBlockGroupById (anyInt ())).thenReturn (Integer .valueOf (0 ));
90
- BlockGroupDto resultData = new BlockGroupDto ();
91
- when (blockGroupMapper .getBlockGroupsById (anyInt ())).thenReturn (Arrays .<BlockGroupDto >asList (resultData ));
92
90
93
- Result <List <BlockGroupDto >> result = blockGroupController .deleteBlockGroups (1 );
94
- Assertions .assertEquals (resultData , result .getData (). get ( 0 ));
91
+ Result <List <BlockGroup >> result = blockGroupController .deleteBlockGroups (1 );
92
+ Assertions .assertEquals ("200" , result .getCode ( ));
95
93
}
96
94
}
0 commit comments