Untitled
unknown
plain_text
a day ago
3.0 kB
6
Indexable
assertTrue(response.status().isSuccess(), restIPVS().getRequestUri() + " Call is failing with " + response.status()); } @Then("the response should contain expected channel data structure") public void verifyChannelsResponseStructure() { // Verify response has expected fields assertTrue(response.hasBody(), "Response does not contain a body"); // Verify channels data contains expected fields assertTrue(response.jsonPath().has("name"), "Response missing 'name' field"); assertTrue(response.jsonPath().has("logoUrl"), "Response missing 'logoUrl' field"); assertTrue(response.jsonPath().has("services"), "Response missing 'services' field"); // Verify linear services structure if present if (response.jsonPath().has("services.linear")) { // Check first linear service has required fields assertTrue(response.jsonPath().has("services.linear[0].callSign"), "Linear service missing 'callSign' field"); assertTrue(response.jsonPath().has("services.linear[0].serviceName"), "Linear service missing 'serviceName' field"); assertTrue(response.jsonPath().has("services.linear[0].ncsServiceId"), "Linear service missing 'ncsServiceId' field"); } // Verify VOD services structure if present if (response.jsonPath().has("services.vod")) { // Check first VOD service has required fields assertTrue(response.jsonPath().has("services.vod[0].serviceName"), "VOD service missing 'serviceName' field"); assertTrue(response.jsonPath().has("services.vod[0].entitled"), "VOD service missing 'entitled' field"); } // Print response for debugging (optional) System.out.println("Channels v4 response: " + response.body()); } @Override public void verifyTestData() {} } package sth.ipvs.rest; import sth.template.rest.BaseRestController; import javax.inject.Inject; public class ChannelsRestController extends BaseRestController { private final String PATH_BASE = "api/smarttv/"; @Override public String baseUrl() { return props.restBaseUrl() + PATH_BASE; } @Inject public void postInit(RequestExecutor executor) { request = RequestFactory.noAuth(baseUrl()) .executor(executor) .timeout(props.requestTimeout()); } public ChannelsRestController channelsV4() { request.reset(); request.path("channels/v4"); return this; } public ChannelsRestController header(String name, String value) { request.header(name, value); return this; } } // Add this method to your IPVSBaseTest class public ChannelsRestController restIPVS() { return container.instance(ChannelsRestController.class); }
Editor is loading...
Leave a Comment