use of com.amazonaws.mobileconnectors.appsync.sigv4.BasicAPIKeyAuthProvider in project aws-mobile-appsync-sdk-android by awslabs.
the class MultiClientInstrumentationTest method testCodeHasInvalidClientDatabasePrefix.
@Test
public void testCodeHasInvalidClientDatabasePrefix() {
AWSConfiguration awsConfiguration = new AWSConfiguration(getTargetContext());
JSONObject appSyncConfig = awsConfiguration.optJsonObject("AppSync");
RuntimeException exception = assertThrows(RuntimeException.class, () -> AWSAppSyncClient.builder().context(getTargetContext()).apiKey(new BasicAPIKeyAuthProvider(appSyncConfig.getString("ApiKey"))).serverUrl(appSyncConfig.getString("ApiUrl")).region(Regions.fromName(appSyncConfig.getString("Region"))).useClientDatabasePrefix(true).clientDatabasePrefix(// This is the problem!!
"MultiAuthAndroidIntegTestApp_!@#$%^&*()").build());
String expected = "ClientDatabasePrefix validation failed. Please pass in characters " + "that matches the pattern: ^[_a-zA-Z0-9]+$";
assertTrue(exception.getLocalizedMessage().startsWith(expected));
}
Aggregations