Skip to content

Commit 924a905

Browse files
author
Jonathan Wenger
committed
Unit tests ready to go
1 parent 912ac70 commit 924a905

File tree

2 files changed

+92
-2
lines changed

2 files changed

+92
-2
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
}

src/test/java/Avalara/SDK/api/EInvoicing/V1/EInvoicingTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ private Configuration getConfiguration() {
4747
configuration.setMachineName("LocalBox");
4848
configuration.setTimeout(5000);
4949
configuration.setEnvironment(AvaTaxEnvironment.Sandbox);
50-
configuration.setBearerToken(
51-
"eyJhbGciOiJSUzI1NiIsImtpZCI6IkRFMjlBOUU2MTQ1OUNDRjAxNjAxQzk1RTk5NzkwMDg1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V9hc3BlY3RfZmV0Y2hcIixcImNvbXBhbnlfYXNwZWN0X3VwZGF0ZVwiLFwiY29tcGFueV9hc3BlY3RfZGVsZXRlXCJdLFwiY1wiOlwiXCJ9XX0iLCJjLWdydCI6Int9Iiwicm9sZXMiOiJ7XCJ1cm46YXZhbGFyYTpzeXN0ZW1zOmRlc1wiOltcIkRFUy1BUEktQ29uc3VtZXJcIl0sXCJ1cm46YXZhbGFyYTpzeXN0ZW1zOm9ybFwiOltcIlZpZXdlclwiXSxcInVybjphdmFsYXJhOnN5c3RlbXM6Y29tcGFueVwiOltcIk9QVVNSb2xlXCJdfSIsImp0aSI6Ijc2QjZBODU2MzJCNEE2N0QwN0Y5RUY2NEIwRjBBNDREIiwiaWF0IjoxNzQ5NzU2MDUzLCJzY29wZSI6WyJkZXNfYXBpIiwib3JsX2FwaSIsInNjcyJdfQ.g-xS7BzA0mmRjmlwj8FlXomoThjqROlkY4qinBVO_CR4NprAG5gMS3c8pxCRkrvrqadYF6bDTvScJARpFlyc2rsM_00iXgRsXwAnpftfK2DytDh3_b9hdX5-t2GbmAFQbj8Rm_nVXeak096JEV_h7AdvSwIAHpVMBAb0JTZtD-9pdBBIsFZeiS6IxFPhzaPlo8RZE1u6t_gGK1swQO9h3q1nW4JwTZCgJ5mmJb7ibSC6EXgcb-UiZ1ot22KxfC6QubEaze3OU2Xar9aux14uLfJBv6STXy7atHRz2rxHQlXoMz8-LG2gg_k_dGdWUs6giaAa5DwnApInsrgPNvLrbw");
50+
configuration.setBearerToken(dotenv.get("E_INVOICING_BEARER_TOKEN"));
5251
return configuration;
5352
}
5453

0 commit comments

Comments
 (0)