Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class BaseMdxGatewayTest extends Specification {

when:
def accounts = new AccountGateway()
subject.setAccounts (accounts)
subject.setAccounts(accounts)

then:
subject.gateways().size() == 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class GatewayConfiguratorTest extends Specification {
assert result["clientName"].behaviors.get(0).getClass().canonicalName == "com.mx.testing.GatewayBehaviorImpl"
assert result["clientName"].id().behaviors.size() == 2
assert result["clientName"].id().behaviors.get(0).getClass().canonicalName == "com.mx.testing.GatewayBehaviorImpl"
assert result["clientName"].id().behaviors.get(1).getClass().canonicalName =="com.mx.testing.MDXGatewayBehaviorImpl"
assert result["clientName"].id().behaviors.get(1).getClass().canonicalName == "com.mx.testing.MDXGatewayBehaviorImpl"
}

def "build gateway with child accessor annotations"() {
Expand All @@ -134,7 +134,9 @@ class GatewayConfiguratorTest extends Specification {
def baseAccessorConf = objectMap.createMap("accessor")
baseAccessorConf.put("class", ChildAccessorBase.class.getCanonicalName())
baseAccessorConf.put("scope", "singleton")
baseAccessorConf.put("configurations", new ObjectMap().tap { put("Wakirimasu ka?", "Hai!") })
baseAccessorConf.put("configurations", new ObjectMap().tap {
put("Wakirimasu ka?", "Hai!")
})
baseAccessorConf.put("connections", new ObjectMap().tap {
put("MyConnection", new ObjectMap().tap {
put("baseUrl", "https://example.com")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public final class AchTransfer extends MdxBase<AchTransfer> {
private String id;
private String achScheduledTransferId;
private Double amount;
private String confirmationId;
private Long createdAt;
@Getter(onMethod_ = { @MdxRelationId(referredClass = Account.class) })
private String fromAccountId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class BaseAccessorTest extends Specification {

then: "It contains accessors for implemented AccountBaseTestAccessor AND StatusBaseAccessor"
result.size() == 2
result.any({it.accessorClass == BaseAccessorTestImplemented.AccountBaseTestAccessor})
result.any({
it.accessorClass == BaseAccessorTestImplemented.AccountBaseTestAccessor
})
result.any({it.accessorClass == StatusDefaultAccessor })
result[0].base.accessorClass == BaseAccessor
result.every({ it.base.accessorClass == BaseAccessor })
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MdxOnDemandMdxListSerializerTest extends MockeryAndSessionRepository {
generator.flush()

then:
def expectedResponse= "<Transaction>\n" +
def expectedResponse = "<Transaction>\n" +
" <amount>9.99</amount>\n" +
" <description>Fees</description>\n" +
" <id>T-123</id>\n" +
Expand Down Expand Up @@ -85,7 +85,7 @@ class MdxOnDemandMdxListSerializerTest extends MockeryAndSessionRepository {
generator.flush()

then:
def expectedResponse= "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<transactions>\n</transactions>\n" +
"</mdx>\n"

Expand All @@ -112,7 +112,7 @@ class MdxOnDemandMdxListSerializerTest extends MockeryAndSessionRepository {
generator.flush()

then:
def expectedResponse= "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<transactions>\n" +
"<Transaction>\n" +
" <amount>9.99</amount>\n" +
Expand Down Expand Up @@ -155,7 +155,7 @@ class MdxOnDemandMdxListSerializerTest extends MockeryAndSessionRepository {
subject.serialize(list, generator, (SerializationContext) null)

then:
def expectedResponse= "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<accounts>\n" +
"<account>\n" +
" <balance>9.99</balance>\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ class DateVersionedResponseTest extends Specification implements WithMockery {
versionedExecuted == versionShouldBeExecuted

where:
contentType || accept || defaultShouldBeExecuted || versionShouldBeExecuted
"application/vnd.mdx.v6+json" || "application/vnd.mdx.v6+json" || true || false
"application/vnd.mdx.v6+json;version=20240101" || "application/vnd.mdx.v6+json" || false || true
"application/vnd.mdx.v6+json" || "application/vnd.mdx.v6+json;version=20240101" || false || true
contentType || accept || defaultShouldBeExecuted || versionShouldBeExecuted
"application/vnd.mdx.v6+json" || "application/vnd.mdx.v6+json" || true || false
"application/vnd.mdx.v6+json;version=20240101" || "application/vnd.mdx.v6+json" || false || true
"application/vnd.mdx.v6+json" || "application/vnd.mdx.v6+json;version=20240101" || false || true
}

def buildRequest(Object body, String contentType, String accept = null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ class ExceptionResolverWebMvcConfigurerTest extends Specification {
response.status == expectedStatus

where:
exception | expectNullMav | expectedStatus
new EOFException() | true | 200
new IOException("Broken pipe") | true | 200
new IOException("Connection reset by peer") | true | 200
new ConnectException("", new EOFException()) | true | 200
new TypeMismatchException("bad value", String) | false | 400
exception | expectNullMav | expectedStatus
new EOFException() | true | 200
new IOException("Broken pipe") | true | 200
new IOException("Connection reset by peer") | true | 200
new ConnectException("", new EOFException()) | true | 200
new TypeMismatchException("bad value", String) | false | 400
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class AchScheduledTransferFrequenciesControllerTest extends Specification implem
BaseController.setGateway(gateway)
def frequency = new Frequency()
def list = new MdxList<Frequency>().tap { add(frequency) }
def queryParameters = new AchScheduledTransferFrequencyListQueryParameters().tap { transfer_type = "test" }
def queryParameters = new AchScheduledTransferFrequencyListQueryParameters().tap {
transfer_type = "test"
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<Frequency>>().withResult(list)).when(achScheduledTransferFrequencyGateway).list(any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class AchTransfersControllerTest extends Specification implements WithMockery {
BaseController.setGateway(gateway)
def transfers = new MdxList<AchTransfer>()
transfers.add(new AchTransfer())
def queryParameters = new AchTransferListQueryParameters().tap { transfer_type = "test" }
def queryParameters = new AchTransferListQueryParameters().tap {
transfer_type = "test"
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<AchTransfer>>().withResult(transfers))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def resultAuthentication = new Authentication()
resultAuthentication.setChallenges(new ArrayList<MfaChallenge>().tap {
add(new MfaChallenge().tap {
setAuthorization(new Authorization().tap { setUrl("https://someUrlForFederatedLogin.com/") })
setAuthorization(new Authorization().tap {
setUrl("https://someUrlForFederatedLogin.com/")
})
})
})

Expand Down Expand Up @@ -590,38 +592,42 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def response = subject.forgotUsername()

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).forgotUsername() || true
response.statusCode == HttpStatus.OK
}

def "forgotUsernameResend - ACCEPTED"() {
given:
AuthenticationController.setGateway(gateway)
def forgotUsername = new ForgotUsername().tap { setChallenge(getChallenge()) }
def forgotUsername = new ForgotUsername().tap {
setChallenge(getChallenge())
}
def expected = new ForgotUsername().tap { setChallenge(new Challenge()) }
doReturn(new AccessorResponse<ForgotUsername>().withResult(expected).withStatus(PathResponseStatus.ACCEPTED)).when(id).answerForgotUsername(forgotUsername)

when:
def response = subject.forgotUsername(forgotUsername)

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).answerForgotUsername(forgotUsername) || true
response.statusCode == HttpStatus.ACCEPTED
}

def "answerForgotUsername - NO_CONTENT"() {
given:
AuthenticationController.setGateway(gateway)
def forgotUsername = new ForgotUsername().tap { setChallenge(getChallenge()) }
def forgotUsername = new ForgotUsername().tap {
setChallenge(getChallenge())
}
doReturn(new AccessorResponse<ForgotUsername>().withResult(new ForgotUsername()).withStatus(PathResponseStatus.NO_CONTENT)).when(id).answerForgotUsername(forgotUsername)

when:
def response = subject.forgotUsername(forgotUsername)

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).answerForgotUsername(forgotUsername) || true
response.statusCode == HttpStatus.NO_CONTENT
}
Expand All @@ -635,7 +641,7 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def response = subject.resetPassword()

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).resetPassword() || true
response.statusCode == HttpStatus.OK
}
Expand All @@ -651,7 +657,7 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def response = subject.resetPassword(resetPassword)

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).answerResetPassword(resetPassword) || true
response.statusCode == HttpStatus.ACCEPTED
}
Expand All @@ -666,7 +672,7 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def response = subject.resetPassword(resetPassword)

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).answerResetPassword(resetPassword) || true
response.statusCode == HttpStatus.NO_CONTENT
}
Expand Down Expand Up @@ -710,7 +716,7 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def response = subject.unlockUser(unlockUser)

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).unlockUser(unlockUser) || true
response.statusCode == HttpStatus.ACCEPTED
response.getBody().challenges.size() > 0
Expand All @@ -726,7 +732,7 @@ class AuthenticationControllerTest extends Specification implements WithMockery
def response = subject.unlockUser(unlockUser)

then:
verify(gateway).id() || true
verify(gateway).id() || true
verify(id).unlockUser(unlockUser) || true
response.statusCode == HttpStatus.NO_CONTENT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import com.mx.path.gateway.api.Gateway
import com.mx.path.gateway.api.account.AccountGateway
import com.mx.path.gateway.api.account.CheckImageGateway
import com.mx.path.gateway.api.account.TransactionGateway
import com.mx.path.model.mdx.model.check.CheckImage
import com.mx.path.model.mdx.web.model.check_image.CheckImagesGetQueryParameters
import com.mx.path.testing.WithMockery

import org.springframework.http.HttpStatus

import spock.lang.Specification

import com.mx.path.model.mdx.model.check.CheckImage

class CheckImagesControllerTest extends Specification implements WithMockery{
CheckImagesController subject
String backCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class CrossAccountRecurringTransferControllerTest extends Specification{
BaseController.setGateway(gateway)

def crossAccountRecurringTransfer = new CrossAccountRecurringTransfer()
def list = new MdxList<CrossAccountRecurringTransfer>().tap { add(crossAccountRecurringTransfer) }
def list = new MdxList<CrossAccountRecurringTransfer>().tap {
add(crossAccountRecurringTransfer)
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<CrossAccountRecurringTransfer>>().withResult(list)).when(crossAccountRecurringTransferGateway).list()
Expand Down Expand Up @@ -102,7 +104,7 @@ class CrossAccountRecurringTransferControllerTest extends Specification{
BaseController.setGateway(gateway)

when:
Mockito.doReturn(new AccessorResponse<Void>()).when(crossAccountRecurringTransferGateway).delete ("id")
Mockito.doReturn(new AccessorResponse<Void>()).when(crossAccountRecurringTransferGateway).delete("id")
def response = subject.deleteCrossAccountRecurringTransfer("id")

then:
Expand All @@ -117,7 +119,7 @@ class CrossAccountRecurringTransferControllerTest extends Specification{

when:
Mockito.doReturn(new AccessorResponse<CrossAccountRecurringTransfer>().withResult(crossAccountRecurringTransfer))
.when(crossAccountRecurringTransferGateway).skipNext ("id")
.when(crossAccountRecurringTransferGateway).skipNext("id")
def response = subject.skipCrossAccountRecurringTransfer("id")

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.springframework.http.HttpStatus

import spock.lang.Specification

class CrossAccountTransferDestinationControllerTest extends Specification {
class CrossAccountTransferDestinationControllerTest extends Specification {
CrossAccountTransferDestinationController subject
Gateway gateway
CrossAccountTransferGateway crossAccountTransferGateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class CrossAccountTransfersControllerTest extends Specification implements WithM
given:
BaseController.setGateway(gateway)
def crossAccountTransfer = new CrossAccountTransfer()
def crossAccountTransfers = new MdxList<CrossAccountTransfer>().tap { add(crossAccountTransfer) }
def crossAccountTransfers = new MdxList<CrossAccountTransfer>().tap {
add(crossAccountTransfer)
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<CrossAccountTransfer>>().withResult(crossAccountTransfers)).when(crossAccountTransferGateway).list()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ class DisputedTransactionsControllerTest extends Specification {
def "listDisputedTransactions interacts with gateway"() {
given:
def disputeId = "4321"
def disputedTransactions = new MdxList<DisputedTransaction>().tap {add(new DisputedTransaction()) }
def disputedTransactions = new MdxList<DisputedTransaction>().tap {
add(new DisputedTransaction())
}
BaseController.setGateway(gateway)
doReturn(new AccessorResponse<MdxList<DisputedTransaction>>().withResult(disputedTransactions)).when(disputedTransactionGateway).list(disputeId)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class OriginationsControllerTest extends Specification {

def "start interacts with gateway"() {
given:
def origination = new Origination().tap { setChallenges(Arrays.asList(new Challenge())) }
def origination = new Origination().tap {
setChallenges(Arrays.asList(new Challenge()))
}
doReturn(new AccessorResponse<Origination>().withResult(origination)).when(originationGateway).start()

when:
Expand Down Expand Up @@ -118,7 +120,9 @@ class OriginationsControllerTest extends Specification {
def "authenticated user start interacts with gateway"() {
given:
initActiveSession()
def origination = new Origination().tap { setChallenges(Arrays.asList(new Challenge())) }
def origination = new Origination().tap {
setChallenges(Arrays.asList(new Challenge()))
}
doReturn(new AccessorResponse<Origination>().withResult(origination)).when(originationGateway).authenticatedUserStart(any())

when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ class ProfilesControllerTest extends Specification {
doReturn(mockResponse).when(profileGateway).updateUserNameWithMFA(any())

when:
def response = subject.updateUserNameWithMFA(new NewUserName() )
def response = subject.updateUserNameWithMFA(new NewUserName())

then:
response.body == mockResponse.result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ class RecurringTransfersControllerTest extends Specification implements WithMock
BaseController.setGateway(gateway)
def transfer = new RecurringTransfer()
def list = new MdxList<RecurringTransfer>().tap { add(transfer) }
def queryParameters = new RecurringTransferListQueryParameters().tap { transfer_type = "test" }
def queryParameters = new RecurringTransferListQueryParameters().tap {
transfer_type = "test"
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<RecurringTransfer>>().withResult(list)).when(recurringTransferGateway).list(any(RecurringTransferListOptions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ class TransfersControllerTest extends Specification {
BaseController.setGateway(gateway)
def transfer = new Transfer()
def list = new MdxList<Transfer>().tap { add(transfer) }
def queryParameters = new TransferListQueryParameters().tap { transfer_type = "test"}
def queryParameters = new TransferListQueryParameters().tap {
transfer_type = "test"
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<Transfer>>().withResult(list)).when(transferGateway).list(any(TransferListOptions))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class VerificationMethodsControllerTest extends Specification {
BaseController.setGateway(gateway)

def verificationMethod = new VerificationMethod()
def verificationMethods = new MdxList<VerificationMethod>().tap { add(verificationMethod) }
def verificationMethods = new MdxList<VerificationMethod>().tap {
add(verificationMethod)
}

when:
Mockito.doReturn(new AccessorResponse<MdxList<VerificationMethod>>().withResult(verificationMethods)).when(verificationMethodGateway).list()
Expand Down
Loading
Loading