@@ -27,8 +27,6 @@ import com.tryfinch.api.errors.UnauthorizedException
2727import com.tryfinch.api.errors.UnexpectedStatusCodeException
2828import com.tryfinch.api.errors.UnprocessableEntityException
2929import com.tryfinch.api.models.*
30- import com.tryfinch.api.models.HrisDirectoryListPage
31- import com.tryfinch.api.models.HrisDirectoryListParams
3230import org.assertj.core.api.Assertions.assertThat
3331import org.assertj.core.api.Assertions.assertThatThrownBy
3432import org.assertj.core.api.InstanceOfAssertFactories
@@ -59,161 +57,177 @@ class ErrorHandlingTest {
5957 }
6058
6159 @Test
62- fun directoryList200 () {
63- val service = client.hris().directory()
64-
65- val params = HrisDirectoryListParams .builder().limit(123L ).offset(123L ).build()
60+ fun companiesRetrieve200 () {
61+ val params = HrisCompanyRetrieveParams .builder().build()
6662
6763 val expected =
68- HrisDirectoryListPage .of(
69- service,
70- params,
71- HrisDirectoryListPage .Response .builder()
72- .individuals(
73- listOf (
74- IndividualInDirectory .builder()
75- .id(" string" )
76- .department(
77- IndividualInDirectory .Department .builder()
78- .name(" string" )
79- .build()
80- )
81- .firstName(" string" )
82- .isActive(true )
83- .lastName(" string" )
84- .manager(
85- IndividualInDirectory .Manager .builder()
86- .id(" e8b90071-0c11-471c-86e8-e303ef2f6782" )
87- .build()
88- )
89- .middleName(" string" )
90- .build()
91- )
64+ Company .builder()
65+ .id(" string" )
66+ .accounts(
67+ listOf (
68+ Company .Account .builder()
69+ .accountName(" string" )
70+ .accountNumber(" string" )
71+ .accountType(Company .Account .AccountType .CHECKING )
72+ .institutionName(" string" )
73+ .routingNumber(" string" )
74+ .build()
9275 )
93- .paging(Paging .builder().count(123L ).offset(123L ).build())
94- .build()
95- )
76+ )
77+ .departments(
78+ listOf (
79+ Company .Department .builder()
80+ .name(" string" )
81+ .parent(Company .Department .Parent .builder().name(" string" ).build())
82+ .build()
83+ )
84+ )
85+ .ein(" string" )
86+ .entity(
87+ Company .Entity .builder()
88+ .subtype(Company .Entity .Subtype .S_CORPORATION )
89+ .type(Company .Entity .Type .LLC )
90+ .build()
91+ )
92+ .legalName(" string" )
93+ .locations(
94+ listOf (
95+ Location .builder()
96+ .city(" string" )
97+ .country(" string" )
98+ .line1(" string" )
99+ .line2(" string" )
100+ .name(" string" )
101+ .postalCode(" string" )
102+ .sourceId(" string" )
103+ .state(" string" )
104+ .build()
105+ )
106+ )
107+ .primaryEmail(" string" )
108+ .primaryPhoneNumber(" string" )
109+ .build()
96110
97- stubFor(get(anyUrl()).willReturn(ok().withBody(toJson(expected.response() ))))
111+ stubFor(get(anyUrl()).willReturn(ok().withBody(toJson(expected))))
98112
99- assertThat(client.hris().directory ().list (params).response()) .isEqualTo(expected.response() )
113+ assertThat(client.hris().company ().retrieve (params)) .isEqualTo(expected)
100114 }
101115
102116 @Test
103- fun directoryList400 () {
104- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
117+ fun companiesRetrieve400 () {
118+ val params = HrisCompanyRetrieveParams .builder().build()
105119
106120 stubFor(
107121 get(anyUrl())
108122 .willReturn(status(400 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
109123 )
110124
111- assertThatThrownBy({ client.hris().directory ().list (params) })
125+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
112126 .satisfies({ e ->
113127 assertBadRequest(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
114128 })
115129 }
116130
117131 @Test
118- fun directoryList401 () {
119- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
132+ fun companiesRetrieve401 () {
133+ val params = HrisCompanyRetrieveParams .builder().build()
120134
121135 stubFor(
122136 get(anyUrl())
123137 .willReturn(status(401 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
124138 )
125139
126- assertThatThrownBy({ client.hris().directory ().list (params) })
140+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
127141 .satisfies({ e ->
128142 assertUnauthorized(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
129143 })
130144 }
131145
132146 @Test
133- fun directoryList403 () {
134- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
147+ fun companiesRetrieve403 () {
148+ val params = HrisCompanyRetrieveParams .builder().build()
135149
136150 stubFor(
137151 get(anyUrl())
138152 .willReturn(status(403 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
139153 )
140154
141- assertThatThrownBy({ client.hris().directory ().list (params) })
155+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
142156 .satisfies({ e ->
143157 assertPermissionDenied(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
144158 })
145159 }
146160
147161 @Test
148- fun directoryList404 () {
149- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
162+ fun companiesRetrieve404 () {
163+ val params = HrisCompanyRetrieveParams .builder().build()
150164
151165 stubFor(
152166 get(anyUrl())
153167 .willReturn(status(404 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
154168 )
155169
156- assertThatThrownBy({ client.hris().directory ().list (params) })
170+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
157171 .satisfies({ e ->
158172 assertNotFound(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
159173 })
160174 }
161175
162176 @Test
163- fun directoryList422 () {
164- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
177+ fun companiesRetrieve422 () {
178+ val params = HrisCompanyRetrieveParams .builder().build()
165179
166180 stubFor(
167181 get(anyUrl())
168182 .willReturn(status(422 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
169183 )
170184
171- assertThatThrownBy({ client.hris().directory ().list (params) })
185+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
172186 .satisfies({ e ->
173187 assertUnprocessableEntity(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
174188 })
175189 }
176190
177191 @Test
178- fun directoryList429 () {
179- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
192+ fun companiesRetrieve429 () {
193+ val params = HrisCompanyRetrieveParams .builder().build()
180194
181195 stubFor(
182196 get(anyUrl())
183197 .willReturn(status(429 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
184198 )
185199
186- assertThatThrownBy({ client.hris().directory ().list (params) })
200+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
187201 .satisfies({ e ->
188202 assertRateLimit(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
189203 })
190204 }
191205
192206 @Test
193- fun directoryList500 () {
194- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
207+ fun companiesRetrieve500 () {
208+ val params = HrisCompanyRetrieveParams .builder().build()
195209
196210 stubFor(
197211 get(anyUrl())
198212 .willReturn(status(500 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
199213 )
200214
201- assertThatThrownBy({ client.hris().directory ().list (params) })
215+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
202216 .satisfies({ e ->
203217 assertInternalServer(e, ImmutableListMultimap .of(" Foo" , " Bar" ), FINCH_ERROR )
204218 })
205219 }
206220
207221 @Test
208222 fun unexpectedStatusCode () {
209- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
223+ val params = HrisCompanyRetrieveParams .builder().build()
210224
211225 stubFor(
212226 get(anyUrl())
213227 .willReturn(status(999 ).withHeader(" Foo" , " Bar" ).withBody(toJson(FINCH_ERROR )))
214228 )
215229
216- assertThatThrownBy({ client.hris().directory ().list (params) })
230+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
217231 .satisfies({ e ->
218232 assertUnexpectedStatusCodeException(
219233 e,
@@ -226,11 +240,11 @@ class ErrorHandlingTest {
226240
227241 @Test
228242 fun invalidBody () {
229- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
243+ val params = HrisCompanyRetrieveParams .builder().build()
230244
231245 stubFor(get(anyUrl()).willReturn(status(200 ).withBody(" Not JSON" )))
232246
233- assertThatThrownBy({ client.hris().directory ().list (params) })
247+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
234248 .satisfies({ e ->
235249 assertThat(e)
236250 .isInstanceOf(FinchException ::class .java)
@@ -240,11 +254,11 @@ class ErrorHandlingTest {
240254
241255 @Test
242256 fun invalidErrorBody () {
243- val params = HrisDirectoryListParams .builder().limit( 123L ).offset( 123L ).build()
257+ val params = HrisCompanyRetrieveParams .builder().build()
244258
245259 stubFor(get(anyUrl()).willReturn(status(400 ).withBody(" Not JSON" )))
246260
247- assertThatThrownBy({ client.hris().directory ().list (params) })
261+ assertThatThrownBy({ client.hris().company ().retrieve (params) })
248262 .satisfies({ e ->
249263 assertBadRequest(e, ImmutableListMultimap .of(), FinchError .builder().build())
250264 })
0 commit comments