|
| 1 | +package Avalara.SDK.api.A1099.V2; |
| 2 | + |
| 3 | +import Avalara.SDK.*; |
| 4 | +import Avalara.SDK.api.A1099.V2.Issuers1099Api; |
| 5 | +import Avalara.SDK.api.A1099.V2.CompaniesW9Api; |
| 6 | +import Avalara.SDK.api.A1099.V2.Forms1099Api; |
| 7 | +import Avalara.SDK.api.A1099.V2.FormsW9Api; |
| 8 | +import Avalara.SDK.model.A1099.V2.*; |
| 9 | +import io.github.cdimascio.dotenv.Dotenv; |
| 10 | +import org.junit.Assert; |
| 11 | +import org.junit.Before; |
| 12 | +import org.junit.Test; |
| 13 | + |
| 14 | +/** |
| 15 | + * API tests for A1099 endpoints using JUnit. |
| 16 | + */ |
| 17 | +public class A1099Test { |
| 18 | + private ApiClient apiClient; |
| 19 | + private Issuers1099Api issuersApi; |
| 20 | + private CompaniesW9Api companiesApi; |
| 21 | + private Forms1099Api forms1099Api; |
| 22 | + |
| 23 | + @Before |
| 24 | + public void setUp() throws Exception { |
| 25 | + // Load environment variables |
| 26 | + Dotenv dotenv = Dotenv.configure().ignoreIfMissing().load(); |
| 27 | + |
| 28 | + Configuration configuration = new Configuration(); |
| 29 | + configuration.setAppName("Test"); |
| 30 | + configuration.setAppVersion("1.0"); |
| 31 | + configuration.setMachineName("LocalBox"); |
| 32 | + configuration.setBearerToken(dotenv.get("A1099_BEARER_TOKEN")); |
| 33 | + configuration.setEnvironment(AvaTaxEnvironment.QA); |
| 34 | + // Override base URL if needed: |
| 35 | + // configuration.setTestBasePath(dotenv.get("A1099_BASE_URL")); |
| 36 | + |
| 37 | + apiClient = new ApiClient(configuration); |
| 38 | + issuersApi = new Issuers1099Api(apiClient); |
| 39 | + companiesApi = new CompaniesW9Api(apiClient); |
| 40 | + forms1099Api = new Forms1099Api(apiClient); |
| 41 | + } |
| 42 | + |
| 43 | + @Test |
| 44 | + public void testGetIssuers() throws Exception { |
| 45 | + Issuers1099Api.GetIssuersRequest request = issuersApi.getGetIssuersRequest(); |
| 46 | + request.set$top(10); |
| 47 | + request.set$skip(0); |
| 48 | + request.setCount(true); |
| 49 | + request.setXCorrelationId("2bbbed41-2466-4cf6-9cca-a3258bdc8eba"); |
| 50 | + |
| 51 | + PaginatedQueryResultModelIssuerResponse response = issuersApi.getIssuers(request); |
| 52 | + Assert.assertNotNull(response); |
| 53 | + Assert.assertNotNull(response.getValue()); |
| 54 | + } |
| 55 | + |
| 56 | + @Test |
| 57 | + public void testGetCompanies() throws Exception { |
| 58 | + CompaniesW9Api.GetCompaniesRequest request = companiesApi.getGetCompaniesRequest(); |
| 59 | + request.set$top(10); |
| 60 | + request.set$skip(0); |
| 61 | + request.setCount(true); |
| 62 | + request.setXCorrelationId("2bbbed41-2466-4cf6-9cca-a3258bdc8eba"); |
| 63 | + |
| 64 | + PaginatedQueryResultModelCompanyResponse response = companiesApi.getCompanies(request); |
| 65 | + Assert.assertNotNull(response); |
| 66 | + Assert.assertNotNull(response.getValue()); |
| 67 | + } |
| 68 | + |
| 69 | + @Test |
| 70 | + public void testList1099Forms() throws Exception { |
| 71 | + Forms1099Api.List1099FormsRequest request = forms1099Api.getList1099FormsRequest(); |
| 72 | + request.set$top(10); |
| 73 | + request.set$skip(0); |
| 74 | + request.setXCorrelationId("2bbbed41-2466-4cf6-9cca-a3258bdc8eba"); |
| 75 | + |
| 76 | + Form1099List response = forms1099Api.list1099Forms(request); |
| 77 | + Assert.assertNotNull(response); |
| 78 | + Assert.assertNotNull(response.getData()); |
| 79 | + } |
| 80 | + |
| 81 | + // @Test |
| 82 | + // public void testListW9Forms() throws Exception { |
| 83 | + // FormsW9Api.ListW9FormsRequest request = formsW9Api.getListW9FormsRequest(); |
| 84 | + // request.setTop(10); |
| 85 | + // request.setSkip(0); |
| 86 | + |
| 87 | + // ListW9FormsResponse response = formsW9Api.listW9Forms(request); |
| 88 | + // Assert.assertNotNull(response); |
| 89 | + // Assert.assertNotNull(response.getValue()); |
| 90 | + // } |
| 91 | +} |
0 commit comments