@Test
  public void testUpdateStorageUsageWithException() throws Exception {
    when(mockInsertStatement.executeUpdate()).thenThrow(new SQLTransientConnectionException());
    TestUtils.assertException(SQLTransientConnectionException.class,
        () -> accountReportsDao.updateStorageUsage(clusterName, hostname, (short) 1, (short) 1000, (short) 8, 100000),
        null);
    assertEquals("Write failure count should be 1", 1, metrics.writeFailureCount.getCount());
  }
Utility to get a {@link DataSource}.
@param mockConnection the connection to use.
@return the {@link DataSource}.
@throws SQLException
ambry-mysql/src/test/java/com/github/ambry/accountstats/AccountReportsDaoTest.java