use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRS in project agent-java-testNG by reportportal.
the class TestUtils method mockLaunch.
@SuppressWarnings("unchecked")
public static void mockLaunch(ReportPortalClient client, String launchUuid, String suiteUuid, String testClassUuid, Collection<String> testMethodUuidList) {
when(client.startLaunch(any())).thenReturn(Maybe.just(new StartLaunchRS(launchUuid, 1L)));
Maybe<ItemCreatedRS> suiteMaybe = Maybe.just(new ItemCreatedRS(suiteUuid, suiteUuid));
when(client.startTestItem(any())).thenReturn(suiteMaybe);
Maybe<ItemCreatedRS> testClassMaybe = Maybe.just(new ItemCreatedRS(testClassUuid, testClassUuid));
when(client.startTestItem(eq(suiteUuid), any())).thenReturn(testClassMaybe);
List<Maybe<ItemCreatedRS>> responses = testMethodUuidList.stream().map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid))).collect(Collectors.toList());
Maybe<ItemCreatedRS> first = responses.get(0);
Maybe<ItemCreatedRS>[] other = responses.subList(1, responses.size()).toArray(new Maybe[0]);
when(client.startTestItem(eq(testClassUuid), any())).thenReturn(first, other);
new HashSet<>(testMethodUuidList).forEach(testMethodUuid -> when(client.finishTestItem(eq(testMethodUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS())));
Maybe<OperationCompletionRS> testClassFinishMaybe = Maybe.just(new OperationCompletionRS());
when(client.finishTestItem(eq(testClassUuid), any())).thenReturn(testClassFinishMaybe);
Maybe<OperationCompletionRS> suiteFinishMaybe = Maybe.just(new OperationCompletionRS());
when(client.finishTestItem(eq(suiteUuid), any())).thenReturn(suiteFinishMaybe);
when(client.finishLaunch(eq(launchUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS()));
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRS in project agent-java-junit5 by reportportal.
the class TestUtils method mockLaunch.
@SuppressWarnings("unchecked")
public static void mockLaunch(ReportPortalClient client, String launchUuid, String testClassUuid, Collection<String> testMethodUuidList) {
when(client.startLaunch(any())).thenReturn(Maybe.just(new StartLaunchRS(launchUuid, 1L)));
Maybe<ItemCreatedRS> testClassMaybe = Maybe.just(new ItemCreatedRS(testClassUuid, testClassUuid));
when(client.startTestItem(any())).thenReturn(testClassMaybe);
List<Maybe<ItemCreatedRS>> responses = testMethodUuidList.stream().map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid))).collect(Collectors.toList());
Maybe<ItemCreatedRS> first = responses.get(0);
Maybe<ItemCreatedRS>[] other = responses.subList(1, responses.size()).toArray(new Maybe[0]);
when(client.startTestItem(eq(testClassUuid), any())).thenReturn(first, other);
new HashSet<>(testMethodUuidList).forEach(testMethodUuid -> when(client.finishTestItem(eq(testMethodUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS())));
Maybe<OperationCompletionRS> testClassFinishMaybe = Maybe.just(new OperationCompletionRS());
when(client.finishTestItem(eq(testClassUuid), any())).thenReturn(testClassFinishMaybe);
when(client.finishLaunch(eq(launchUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS()));
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRS in project allure-java by reportportal.
the class TestUtils method mockLaunch.
@SuppressWarnings("unchecked")
public static void mockLaunch(ReportPortalClient client, String launchUuid, String suiteUuid, String testClassUuid, Collection<String> testMethodUuidList) {
when(client.startLaunch(any())).thenReturn(TestUtils.createMaybe(new StartLaunchRS(launchUuid, 1L)));
Maybe<ItemCreatedRS> suiteMaybe = TestUtils.createMaybe(new ItemCreatedRS(suiteUuid, suiteUuid));
when(client.startTestItem(any())).thenReturn(suiteMaybe);
Maybe<ItemCreatedRS> testClassMaybe = TestUtils.createMaybe(new ItemCreatedRS(testClassUuid, testClassUuid));
when(client.startTestItem(eq(suiteUuid), any())).thenReturn(testClassMaybe);
List<Maybe<ItemCreatedRS>> responses = testMethodUuidList.stream().map(uuid -> TestUtils.createMaybe(new ItemCreatedRS(uuid, uuid))).collect(Collectors.toList());
Maybe<ItemCreatedRS> first = responses.get(0);
Maybe<ItemCreatedRS>[] other = responses.subList(1, responses.size()).toArray(new Maybe[0]);
when(client.startTestItem(eq(testClassUuid), any())).thenReturn(first, other);
new HashSet<>(testMethodUuidList).forEach(testMethodUuid -> when(client.finishTestItem(eq(testMethodUuid), any())).thenReturn(TestUtils.createMaybe(new OperationCompletionRS())));
Maybe<OperationCompletionRS> testClassFinishMaybe = TestUtils.createMaybe(new OperationCompletionRS());
when(client.finishTestItem(eq(testClassUuid), any())).thenReturn(testClassFinishMaybe);
Maybe<OperationCompletionRS> suiteFinishMaybe = TestUtils.createMaybe(new OperationCompletionRS());
when(client.finishTestItem(eq(suiteUuid), any())).thenReturn(suiteFinishMaybe);
when(client.finishLaunch(eq(launchUuid), any())).thenReturn(TestUtils.createMaybe(new OperationCompletionRS()));
}
Aggregations