@Test public void testTableExistException() { EasyMock.expect(dynamoDB.describeTable(tableName)).andThrow(new AmazonClientException("")); PowerMock.replayAll(); assertFalse(DynamoDBManager.doesTableExist(dynamoDB, tableName)); PowerMock.verifyAll(); }
public static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName) { try { dynamoDB.describeTable(tableName); return true; } catch (final ResourceNotFoundException e) { return false; } catch (final AmazonClientException e) { LOGGER.severe(e.getMessage()); return false; } }
DynamoDBManager { public static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName) { try { dynamoDB.describeTable(tableName); return true; } catch (final ResourceNotFoundException e) { return false; } catch (final AmazonClientException e) { LOGGER.severe(e.getMessage()); return false; } } }
DynamoDBManager { public static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName) { try { dynamoDB.describeTable(tableName); return true; } catch (final ResourceNotFoundException e) { return false; } catch (final AmazonClientException e) { LOGGER.severe(e.getMessage()); return false; } } private  DynamoDBManager(); }
DynamoDBManager { public static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName) { try { dynamoDB.describeTable(tableName); return true; } catch (final ResourceNotFoundException e) { return false; } catch (final AmazonClientException e) { LOGGER.severe(e.getMessage()); return false; } } private  DynamoDBManager(); static TableDescription createTable(final AmazonDynamoDB dynamoDB, final CreateTableRequest request); static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName); static TableStatus getTableStatus(final AmazonDynamoDB dynamoDB, final String tableName); static void waitForTableToBecomeActive(final AmazonDynamoDB dynamoDB, final String tableName); }
DynamoDBManager { public static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName) { try { dynamoDB.describeTable(tableName); return true; } catch (final ResourceNotFoundException e) { return false; } catch (final AmazonClientException e) { LOGGER.severe(e.getMessage()); return false; } } private  DynamoDBManager(); static TableDescription createTable(final AmazonDynamoDB dynamoDB, final CreateTableRequest request); static boolean doesTableExist(final AmazonDynamoDB dynamoDB, final String tableName); static TableStatus getTableStatus(final AmazonDynamoDB dynamoDB, final String tableName); static void waitForTableToBecomeActive(final AmazonDynamoDB dynamoDB, final String tableName);  }