use of com.epam.ta.reportportal.ws.model.widget.SortEntry in project service-api by reportportal.
the class HealthCheckTableReadyContentResolverTest method getContentTest.
@Test
void getContentTest() {
WidgetRQ widgetRQ = new WidgetRQ();
widgetRQ.setName("name");
widgetRQ.setWidgetType("componentHealthCheckTable");
ContentParameters contentParameters = new ContentParameters();
contentParameters.setContentFields(new ArrayList<>());
contentParameters.setItemsCount(600);
Map<String, Object> options = new HashMap<>();
contentParameters.setWidgetOptions(options);
widgetRQ.setContentParameters(contentParameters);
widgetRQ.setFilterIds(Collections.singletonList(1L));
widgetRQ.setDescription("descr");
SortEntry sortEntry = new SortEntry();
sortEntry.setSortingColumn("passingRate");
Widget widget = new WidgetBuilder().addWidgetRq(widgetRQ).addOption("viewName", "name").addOption("sort", sortEntry).addOption(ATTRIBUTE_KEYS, Lists.newArrayList("k1", "k2")).get();
HealthCheckTableContent content = new HealthCheckTableContent();
content.setAttributeValue("v2");
content.setPassingRate(50.00);
HashMap<String, Integer> statistics = new HashMap<>();
statistics.put(EXECUTIONS_PASSED, 5);
statistics.put(EXECUTIONS_TOTAL, 10);
content.setStatistics(statistics);
when(widgetContentRepository.componentHealthCheckTable(any())).thenReturn(Lists.newArrayList(content));
MultiValueMap<String, String> values = new LinkedMultiValueMap<>();
values.put(ATTRIBUTES, Lists.newArrayList("v1"));
Map<String, Object> result = contentResolver.loadContent(widget, values);
List<HealthCheckTableContent> resultList = (List<HealthCheckTableContent>) result.get("result");
HealthCheckTableContent tableContent = resultList.get(0);
assertEquals(content.getPassingRate(), tableContent.getPassingRate());
assertEquals(content.getAttributeValue(), tableContent.getAttributeValue());
}
Aggregations