Skip to content

Commit 7484325

Browse files
committed
Update feature test to match change in in exception
1 parent cc73c2c commit 7484325

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/featuretest/generators/testcasegenerators/FetchAuthSessionTestCaseGenerator.kt

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import aws.sdk.kotlin.services.cognitoidentityprovider.model.ResourceNotFoundExc
2020
import com.amplifyframework.auth.AWSCognitoUserPoolTokens
2121
import com.amplifyframework.auth.AWSCredentials
2222
import com.amplifyframework.auth.cognito.AWSCognitoAuthSession
23+
import com.amplifyframework.auth.cognito.exceptions.service.ResourceNotFoundException as AmplifyResourceNotFoundException
2324
import com.amplifyframework.auth.cognito.featuretest.API
2425
import com.amplifyframework.auth.cognito.featuretest.AuthAPI
2526
import com.amplifyframework.auth.cognito.featuretest.CognitoType
@@ -75,7 +76,7 @@ object FetchAuthSessionTestCaseGenerator : SerializableProvider {
7576
CognitoType.CognitoIdentity,
7677
"getId",
7778
ResponseType.Failure,
78-
TooManyRequestsException.invoke {
79+
TooManyRequestsException {
7980
message = "Error type: Client, Protocol response: (empty response)"
8081
}.toJsonElement()
8182
)
@@ -98,7 +99,7 @@ object FetchAuthSessionTestCaseGenerator : SerializableProvider {
9899
CognitoType.CognitoIdentity,
99100
"getCredentialsForIdentity",
100101
ResponseType.Failure,
101-
TooManyRequestsException.invoke {
102+
TooManyRequestsException {
102103
message = "Error type: Client, Protocol response: (empty response)"
103104
}.toJsonElement()
104105
)
@@ -107,7 +108,7 @@ object FetchAuthSessionTestCaseGenerator : SerializableProvider {
107108
CognitoType.CognitoIdentityProvider,
108109
"getTokensFromRefreshToken",
109110
ResponseType.Failure,
110-
ResourceNotFoundException.invoke {
111+
ResourceNotFoundException {
111112
message = "Error type: Client, Protocol response: (empty response)"
112113
}.toJsonElement()
113114
)
@@ -156,20 +157,24 @@ object FetchAuthSessionTestCaseGenerator : SerializableProvider {
156157

157158
private val unknownRefreshException = UnknownException(
158159
message = "Fetch auth session failed.",
159-
cause = ResourceNotFoundException.invoke { }
160+
cause = ResourceNotFoundException { }
160161
)
161162

162163
private val identityRefreshException = UnknownException(
163164
message = "Fetch auth session failed.",
164-
cause = TooManyRequestsException.invoke { }
165+
cause = TooManyRequestsException { }
166+
)
167+
168+
private val resourceNotFoundException = AmplifyResourceNotFoundException(
169+
cause = ResourceNotFoundException { }
165170
)
166171

167172
private val expectedRefreshFailure = AWSCognitoAuthSession(
168173
isSignedIn = true,
169-
identityIdResult = AuthSessionResult.failure(unknownRefreshException),
170-
awsCredentialsResult = AuthSessionResult.failure(unknownRefreshException),
171-
userSubResult = AuthSessionResult.failure(unknownRefreshException),
172-
userPoolTokensResult = AuthSessionResult.failure(unknownRefreshException)
174+
identityIdResult = AuthSessionResult.failure(resourceNotFoundException),
175+
awsCredentialsResult = AuthSessionResult.failure(resourceNotFoundException),
176+
userSubResult = AuthSessionResult.failure(resourceNotFoundException),
177+
userPoolTokensResult = AuthSessionResult.failure(resourceNotFoundException)
173178
).toJsonElement()
174179

175180
private val expectedRefreshIdentityFailure = AWSCognitoAuthSession(

aws-auth-cognito/src/test/resources/feature-test/testsuites/fetchAuthSession/AuthSession_object_is_successfully_returned_after_failed_refresh.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,37 @@
3030
"response": {
3131
"accessToken": null,
3232
"awsCredentialsResult": {
33-
"errorType": "UnknownException",
34-
"errorMessage": "Fetch auth session failed.",
35-
"recoverySuggestion": "See the attached exception for more details",
33+
"errorType": "ResourceNotFoundException",
34+
"errorMessage": "Could not find the requested online resource.",
35+
"recoverySuggestion": "Retry with exponential back-off or check your config file to be sure the endpoint is valid.",
3636
"cause": {
3737
"errorType": "ResourceNotFoundException",
3838
"errorMessage": "Error type: Client, Protocol response: (empty response)"
3939
}
4040
},
4141
"identityIdResult": {
42-
"errorType": "UnknownException",
43-
"errorMessage": "Fetch auth session failed.",
44-
"recoverySuggestion": "See the attached exception for more details",
42+
"errorType": "ResourceNotFoundException",
43+
"errorMessage": "Could not find the requested online resource.",
44+
"recoverySuggestion": "Retry with exponential back-off or check your config file to be sure the endpoint is valid.",
4545
"cause": {
4646
"errorType": "ResourceNotFoundException",
4747
"errorMessage": "Error type: Client, Protocol response: (empty response)"
4848
}
4949
},
5050
"isSignedIn": true,
5151
"userPoolTokensResult": {
52-
"errorType": "UnknownException",
53-
"errorMessage": "Fetch auth session failed.",
54-
"recoverySuggestion": "See the attached exception for more details",
52+
"errorType": "ResourceNotFoundException",
53+
"errorMessage": "Could not find the requested online resource.",
54+
"recoverySuggestion": "Retry with exponential back-off or check your config file to be sure the endpoint is valid.",
5555
"cause": {
5656
"errorType": "ResourceNotFoundException",
5757
"errorMessage": "Error type: Client, Protocol response: (empty response)"
5858
}
5959
},
6060
"userSubResult": {
61-
"errorType": "UnknownException",
62-
"errorMessage": "Fetch auth session failed.",
63-
"recoverySuggestion": "See the attached exception for more details",
61+
"errorType": "ResourceNotFoundException",
62+
"errorMessage": "Could not find the requested online resource.",
63+
"recoverySuggestion": "Retry with exponential back-off or check your config file to be sure the endpoint is valid.",
6464
"cause": {
6565
"errorType": "ResourceNotFoundException",
6666
"errorMessage": "Error type: Client, Protocol response: (empty response)"

0 commit comments

Comments
 (0)