All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.anet-java-sdk.1.9.2.source-code.ControllerTemplateTestt Maven / Gradle / Ivy

Go to download

Authorize.Net SDK includes standard payments, recurring billing, and customer profiles.

There is a newer version: 3.0.0
Show newest version
package net.authorize.api.controller.mocktest;

import java.util.ArrayList;
import java.util.List;

import junit.framework.Assert;
import net.authorize.api.contract.v1.ANetApiResponse;
import net.authorize.api.contract.v1.APICONTROLLERNAMERequest;
import net.authorize.api.contract.v1.APICONTROLLERNAMEResponse;
import net.authorize.api.contract.v1.MessageTypeEnum;
import net.authorize.api.controller.base.IApiOperation;
import net.authorize.api.controller.test.ApiCoreTestBase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class APICONTROLLERNAMEControllerTest extends ApiCoreTestBase {
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		ApiCoreTestBase.setUpBeforeClass();
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
		ApiCoreTestBase.tearDownAfterClass();
	}

	@Before
	public void setUp() throws Exception {
		super.setUp();
	}

	@After
	public void tearDown() throws Exception {
		super.tearDown();
	}

	@Test
	public void mockAPICONTROLLERNAMEControllerTest()
	{
		//define all mocked objects as final
		final IApiOperation mockController = getMockController();
		
		final APICONTROLLERNAMERequest mockRequest = factory.createAPICONTROLLERNAMERequest();
		mockRequest.setRefId(refId);
		
		final APICONTROLLERNAMEResponse   mockResponse = factory.createAPICONTROLLERNAMEResponse();

		final ANetApiResponse errorResponse = factory.createANetApiResponse();
		final List results = new ArrayList();
		final MessageTypeEnum messageTypeOk = MessageTypeEnum.OK;
		
		setMockControllerExpectations(mockController, mockRequest, mockResponse, errorResponse, results, messageTypeOk);
		//setMockControllerExpectations(mockController, mockResponse, null, null, null);
		mockController.execute();
		APICONTROLLERNAMEResponse controllerResponse = mockController.getApiResponse();
		
		Assert.assertNotNull(controllerResponse);
		Assert.assertNotNull(controllerResponse.getYYY());
		logger.info(String.format("APICONTROLLERNAME: Details:%s", controllerResponse.getYYY()));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy