use of com.epam.ta.reportportal.dao.LaunchRepository in project service-api by reportportal.
the class StartLaunchHandlerImplTest method startLaunch.
@Test
void startLaunch() {
final ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setStartTime(new Date());
startLaunchRQ.setName("test");
Launch launch = new Launch();
launch.setId(1L);
when(launchRepository.save(any(Launch.class))).then(a -> {
Launch l = a.getArgument(0);
l.setId(1L);
return l;
}).thenReturn(launch);
final StartLaunchRS startLaunchRS = startLaunchHandlerImpl.startLaunch(rpUser, extractProjectDetails(rpUser, "test_project"), startLaunchRQ);
verify(launchRepository, times(1)).refresh(any(Launch.class));
verify(eventPublisher, times(1)).publishEvent(any());
assertNotNull(startLaunchRS);
}
Aggregations