use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class UniqueBugContentValidatorTest method testValidateWithException.
@Test
public void testValidateWithException() {
Exception exception = assertThrows(ReportPortalException.class, () -> {
uniqueBugContentValidator.validate(Collections.singletonList("test"), new HashMap<>(), new WidgetOptions(), 5);
});
String expectedMessage = "Filter-Sort mapping should not be empty";
String actualMessage = exception.getMessage();
assertTrue(actualMessage.contains(expectedMessage));
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class WidgetOptionUtilTest method getStringValueWhenCorrectTypeTest.
@Test
void getStringValueWhenCorrectTypeTest() {
// given
WidgetOptions widgetOptions = new WidgetOptions(getMapWithStringValues());
// when
String value = WidgetOptionUtil.getValueByKey(FIRST_KEY, widgetOptions);
// then
assertNotNull(value);
assertEquals(FIRST_STRING_VALUE, value);
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class WidgetOptionUtilTest method throwExceptionWhenGetMapValueWithInCorrectTypeTest.
@Test
void throwExceptionWhenGetMapValueWithInCorrectTypeTest() {
// given
WidgetOptions widgetOptions = new WidgetOptions(getMapWithStringValues());
// when //then throw exception
assertThrows(ReportPortalException.class, () -> WidgetOptionUtil.getMapByKey(FIRST_KEY, widgetOptions));
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class MostTimeConsumingContentValidatorTest method testValidateWithException.
@Test
public void testValidateWithException() {
Exception exception = assertThrows(ReportPortalException.class, () -> {
HashMap<Filter, Sort> filterSortMap = new HashMap<>();
filterSortMap.put(Filter.builder().withTarget(Launch.class).withCondition(FilterCondition.builder().eq("id", "1").build()).build(), Sort.unsorted());
Map<String, Object> params = new HashMap<>();
params.put(LAUNCH_NAME_FIELD, "");
WidgetOptions widgetOptions = new WidgetOptions();
mostTimeConsumingContentValidator.validate(Collections.singletonList("test"), filterSortMap, widgetOptions, 5);
});
String expectedMessage = LAUNCH_NAME_FIELD + " should be specified for widget.";
String actualMessage = exception.getMessage();
assertTrue(actualMessage.contains(expectedMessage));
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class PassingRatePerLaunchContentValidatorTest method testValidateWithException.
@Test
public void testValidateWithException() {
Exception exception = assertThrows(ReportPortalException.class, () -> {
HashMap<Filter, Sort> filterSortMap = new HashMap<>();
filterSortMap.put(Filter.builder().withTarget(Launch.class).withCondition(FilterCondition.builder().eq("id", "1").build()).build(), Sort.unsorted());
Map<String, Object> params = new HashMap<>();
params.put(LAUNCH_NAME_FIELD, "");
WidgetOptions widgetOptions = new WidgetOptions();
passingRatePerLaunchContentValidator.validate(Collections.singletonList("test"), filterSortMap, widgetOptions, 5);
});
String expectedMessage = LAUNCH_NAME_FIELD + " should be specified for widget.";
String actualMessage = exception.getMessage();
assertTrue(actualMessage.contains(expectedMessage));
}
Aggregations