use of com.epam.ta.reportportal.ws.model.TestItemResource in project service-api by reportportal.
the class TestItemConverterTest method toResource.
@Test
void toResource() {
final TestItem item = getItem(true);
final TestItemResource resource = TestItemConverter.TO_RESOURCE.apply(item);
assertEquals(resource.getName(), item.getName());
assertEquals(resource.getDescription(), item.getDescription());
assertEquals(resource.getLaunchId(), item.getLaunchId());
assertEquals(resource.getUuid(), item.getUuid());
assertEquals(resource.getItemId(), item.getItemId());
assertEquals(resource.getParent(), item.getParentId());
assertEquals(resource.getPath(), item.getPath());
assertEquals(resource.getStatus(), item.getItemResults().getStatus().name());
assertEquals(resource.getType(), item.getType().name());
assertEquals(resource.getStartTime(), Date.from(item.getStartTime().atZone(ZoneId.of("UTC")).toInstant()));
assertEquals(resource.getEndTime(), Date.from(item.getItemResults().getEndTime().atZone(ZoneId.of("UTC")).toInstant()));
assertEquals(resource.getUniqueId(), item.getUniqueId());
assertThat(resource.getAttributes().stream().map(ItemAttributeConverter.FROM_RESOURCE).collect(Collectors.toSet())).containsExactlyElementsOf(item.getAttributes());
assertThat(resource.getParameters().stream().map(ParametersConverter.TO_MODEL).collect(Collectors.toSet())).containsExactlyElementsOf(item.getParameters());
assertThat(resource.getStatisticsResource()).isEqualToComparingFieldByField(StatisticsConverter.TO_RESOURCE.apply(item.getItemResults().getStatistics()));
assertEquals(resource.getIssue().getComment(), item.getItemResults().getIssue().getIssueDescription());
assertEquals(resource.getIssue().getAutoAnalyzed(), item.getItemResults().getIssue().getAutoAnalyzed());
assertEquals(resource.getIssue().getIssueType(), item.getItemResults().getIssue().getIssueType().getLocator());
assertEquals(resource.getIssue().getIgnoreAnalyzer(), item.getItemResults().getIssue().getIgnoreAnalyzer());
}
use of com.epam.ta.reportportal.ws.model.TestItemResource in project service-api by reportportal.
the class TestItemConverterTest method toResourceWithoutIssue.
@Test
void toResourceWithoutIssue() {
final TestItem item = getItem(false);
final TestItemResource resource = TestItemConverter.TO_RESOURCE.apply(item);
assertEquals(resource.getName(), item.getName());
assertEquals(resource.getDescription(), item.getDescription());
assertEquals(resource.getLaunchId(), item.getLaunchId());
assertEquals(resource.getUuid(), item.getUuid());
assertEquals(resource.getItemId(), item.getItemId());
assertEquals(resource.getParent(), item.getParentId());
assertEquals(resource.getPath(), item.getPath());
assertEquals(resource.getStatus(), item.getItemResults().getStatus().name());
assertEquals(resource.getType(), item.getType().name());
assertEquals(resource.getStartTime(), Date.from(item.getStartTime().atZone(ZoneId.of("UTC")).toInstant()));
assertEquals(resource.getEndTime(), Date.from(item.getItemResults().getEndTime().atZone(ZoneId.of("UTC")).toInstant()));
assertEquals(resource.getUniqueId(), item.getUniqueId());
assertThat(resource.getAttributes().stream().map(ItemAttributeConverter.FROM_RESOURCE).collect(Collectors.toSet())).containsExactlyElementsOf(item.getAttributes());
assertThat(resource.getParameters().stream().map(ParametersConverter.TO_MODEL).collect(Collectors.toSet())).containsExactlyElementsOf(item.getParameters());
assertThat(resource.getStatisticsResource()).isEqualToComparingFieldByField(StatisticsConverter.TO_RESOURCE.apply(item.getItemResults().getStatistics()));
assertNull(resource.getIssue());
}
use of com.epam.ta.reportportal.ws.model.TestItemResource in project service-api by reportportal.
the class TestItemResourceAssembler method toResource.
public TestItemResource toResource(TestItem entity, @Nullable PathName pathName) {
TestItemResource resource = TestItemConverter.TO_RESOURCE.apply(entity);
ofNullable(pathName).ifPresent(pn -> resource.setPathNames(TestItemConverter.PATH_NAME_TO_RESOURCE.apply(pn)));
return resource;
}
Aggregations