[Test-4124][service] Add the testCreateCommand test of ProcessService Class (#5257)

* [uint test] Improve code test coverage of ProcessService class

* [Test-4124][service] Add the testCreateCommand test of ProcessService Class

Co-authored-by: liuziying <liuziying@longfor.com>
This commit is contained in:
Bruce Lau 2021-04-12 18:55:00 +08:00 committed by GitHub
parent 039d517c13
commit 3e64f43138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -464,4 +464,17 @@ public class ProcessServiceTest {
processService.changeOutParam(result,taskInstance);
}
@Test
public void testCreateCommand() {
Command command = new Command();
command.setProcessDefinitionId(123);
command.setCommandParam("{\"ProcessInstanceId\":222}");
command.setCommandType(CommandType.START_PROCESS);
int mockResult = 1;
Mockito.when(commandMapper.insert(command)).thenReturn(mockResult);
int exeMethodResult = processService.createCommand(command);
Assert.assertEquals(mockResult, exeMethodResult);
Mockito.verify(commandMapper, Mockito.times(1)).insert(command);
}
}