/*
* 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/StandardTesting/Client_Rescript_Post_RequestTypes_Integers_Zeroes.xls;
package com.betfair.cougar.tests.clienttests.standardtesting;
import com.betfair.baseline.v2.BaselineSyncClient;
import com.betfair.baseline.v2.to.BodyParamI32Object;
import com.betfair.baseline.v2.to.I32OperationResponseObject;
import com.betfair.cougar.api.ExecutionContext;
import com.betfair.cougar.tests.clienttests.ClientTestsHelper;
import com.betfair.cougar.tests.clienttests.CougarClientWrapper;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.AssertJUnit.assertEquals;
/**
* Ensure that when an (Zeroe) Integer object is passed in parameters to cougar via a cougar client, the request is sent and the response is handled correctly
*/
public class ClientPostRequestTypesIntegersZeroesTest {
@Test(dataProvider = "TransportType")
public void doTest(CougarClientWrapper.TransportType tt) throws Exception {
// Set up the client to use rescript transport
CougarClientWrapper cougarClientWrapper1 = CougarClientWrapper.getInstance(tt);
CougarClientWrapper wrapper = cougarClientWrapper1;
BaselineSyncClient client = cougarClientWrapper1.getClient();
ExecutionContext context = cougarClientWrapper1.getCtx();
// Create body parameter to be passed
BodyParamI32Object bodyParamI32Object2 = new BodyParamI32Object();
bodyParamI32Object2.setBodyParameter((int) 0);
BodyParamI32Object bodyParam = bodyParamI32Object2;
// Make call to the method (passing 0s) via client and validate response is as expected
I32OperationResponseObject response3 = client.i32Operation(context, (int) 0, (int) 0, bodyParam);
assertEquals(0, (int) response3.getQueryParameter());
assertEquals(0, (int) response3.getHeaderParameter());
assertEquals(0, (int) response3.getBodyParameter());
}
@DataProvider(name="TransportType")
public Object[][] clients() {
return ClientTestsHelper.clientsToTest();
}
}