use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetOutagesResponse in project open-smart-grid-platform by OSGP.
the class BundledGetOutagesSteps method theBundleResponseShouldContainAGetOutagesResponseWithValues.
@Then("^the bundle response should contain a get outages response with (\\d++) outages$")
public void theBundleResponseShouldContainAGetOutagesResponseWithValues(final int numberOfEvents, final Map<String, String> expectedValues) throws Throwable {
final Response response = this.getNextBundleResponse();
assertThat(response instanceof GetOutagesResponse).isTrue();
final GetOutagesResponse outagesResponse = (GetOutagesResponse) response;
final List<Outage> outages = outagesResponse.getOutages();
assertThat(outages.size()).isEqualTo(numberOfEvents);
final Map<String, String> values = outages.stream().collect(Collectors.toMap(o -> o.getEndTime().toString(), o -> o.getDuration().toString()));
assertThat(values).containsExactlyInAnyOrderEntriesOf(expectedValues);
}
Aggregations