Skip to content

Commit

Permalink
feat(Gate): Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiodmota committed Apr 18, 2023
1 parent 554fea0 commit 28a3139
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.PageStartAfterResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.ValidationResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.ValidationStatus
import org.eclipse.tractusx.bpdm.gate.config.SaasConfigProperties

import org.eclipse.tractusx.bpdm.gate.util.*
import org.eclipse.tractusx.bpdm.gate.util.EndpointValues.SAAS_MOCK_BUSINESS_PARTNER_PATH
import org.eclipse.tractusx.bpdm.gate.util.EndpointValues.SAAS_MOCK_RELATIONS_PATH
Expand Down Expand Up @@ -352,9 +353,12 @@ internal class AddressControllerInputIT @Autowired constructor(
val total = 10
val invalidEntries = 0



wireMockServer.stubFor(
get(urlPathMatching(SAAS_MOCK_BUSINESS_PARTNER_PATH))
.withQueryParam("externalId", absent())
.withQueryParam("externalId", matching(".*"))
.withQueryParam("typeTechnicalKeys", matching(".*"))
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
Expand All @@ -375,6 +379,7 @@ internal class AddressControllerInputIT @Autowired constructor(
wireMockServer.stubFor(
get(urlPathMatching(SAAS_MOCK_BUSINESS_PARTNER_PATH))
.withQueryParam("externalId", matching(".*"))
.withQueryParam("typeTechnicalKeys", absent())
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
Expand All @@ -392,10 +397,10 @@ internal class AddressControllerInputIT @Autowired constructor(
)
)

val paginationValue = PaginationStartAfterRequest(startAfter, limit)
val pageResponse = gateClient.addresses().getAddresses(paginationValue)
val listExternalIds = addressesSaas.mapNotNull { it.externalId }
gateClient.addresses().getAddressesByExternalIds(paginationValue, listExternalIds)

val paginationValue = PaginationStartAfterRequest(startAfter, limit)
val pageResponse = gateClient.addresses().getAddressesByExternalIds(paginationValue, listExternalIds)

assertThat(pageResponse).isEqualTo(
PageStartAfterResponse(
Expand Down

0 comments on commit 28a3139

Please sign in to comment.