You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have data validity checks in the init blocks of the application class and its fields.
Such as:
init {
if (!onlySelectedIsPresent(entitlementByCardType, cardType)) {
throw InvalidJsonException("The specified entitlement(s) do not match card type.")
}
if ((applicationType != null) != (cardType == BavariaCardType.BLUE)) {
throw InvalidJsonException("Application type must not be null if and only if card type is blue.")
}
if (!wantsPhysicalCard && !wantsDigitalCard) {
throw InvalidJsonException("Does not apply for a physical nor for a digital card.")
}
if (!hasAcceptedPrivacyPolicy) {
throw InvalidJsonException("Has not accepted privacy policy.")
}
if (!givenInformationIsCorrectAndComplete) {
throw InvalidJsonException("Has not confirmed that information is correct and complete.")
}
}
Integration tests should be added to check the response when an invalid application is sent.
In the current approach (see Verein360ApplicationTest class) we create an Application object, serialize it, and send in the request.
But it's not possible to create an application object with invalid values, such as givenInformationIsCorrectAndComplete = false because this will throw an exception.
Describe Your Preferred Solution
We need another approach to generate test requests.
For example, build application as a string, instead of an object?
Or create a fake test application class without init blocks?
Or think of better options.
Describe Possible Alternatives
Probably mock or spy objects can be used
Related Issues
Additional Information
The text was updated successfully, but these errors were encountered:
Describe the Problem
We have data validity checks in the init blocks of the application class and its fields.
Such as:
Integration tests should be added to check the response when an invalid application is sent.
In the current approach (see Verein360ApplicationTest class) we create an Application object, serialize it, and send in the request.
But it's not possible to create an application object with invalid values, such as givenInformationIsCorrectAndComplete = false because this will throw an exception.
Describe Your Preferred Solution
We need another approach to generate test requests.
For example, build application as a string, instead of an object?
Or create a fake test application class without init blocks?
Or think of better options.
Describe Possible Alternatives
Probably mock or spy objects can be used
Related Issues
Additional Information
The text was updated successfully, but these errors were encountered: