/* * Copyright 2013, The Sporting Exchange Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Originally from ClientTests/Transport/ResponseTypes/Client_Rescript_MapResponse.xls; package com.betfair.cougar.tests.clienttests.responsetypes; import com.betfair.baseline.v2.BaselineSyncClient; import com.betfair.cougar.api.ExecutionContext; import com.betfair.cougar.tests.clienttests.ClientTestsHelper; import com.betfair.cougar.tests.clienttests.CougarClientResponseTypeUtils; import com.betfair.cougar.tests.clienttests.CougarClientWrapper; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.util.Map; import static org.testng.AssertJUnit.assertEquals; /** * Ensure an operation performed against cougar via a cougar client can have a map as a response object */ public class ClientMapResponseTest { @Test(dataProvider = "TransportType") public void doTest(CougarClientWrapper.TransportType tt) throws Exception { // Set up client CougarClientWrapper cougarClientWrapper1 = CougarClientWrapper.getInstance(tt); CougarClientWrapper wrapper = cougarClientWrapper1; BaselineSyncClient client = cougarClientWrapper1.getClient(); ExecutionContext context = cougarClientWrapper1.getCtx(); // Build the map object that is the expected repsonse CougarClientResponseTypeUtils cougarClientResponseTypeUtils2 = new CougarClientResponseTypeUtils(); Map<String, String> requestMap = cougarClientResponseTypeUtils2.buildMap("entry1,entry2,entry3,entry4", "aaa,bbb,ccc,ddd"); // Call method using recript transport and check the received map response is as expected Map<String, String> map3 = client.testSimpleMapGet(context, requestMap); assertEquals("aaa", map3.get("entry1")); assertEquals("bbb", map3.get("entry2")); assertEquals("ccc", map3.get("entry3")); assertEquals("ddd", map3.get("entry4")); } @DataProvider(name="TransportType") public Object[][] clients() { return ClientTestsHelper.clientsToTest(); } }