@Test
  public void testInsertMonthWithException() throws Exception {
    long writeFailureCountBefore = metrics.writeFailureCount.getCount();
    when(mockInsertMonthStatement.executeUpdate()).thenThrow(new SQLTransientConnectionException());
    TestUtils.assertException(SQLTransientConnectionException.class,
        () -> aggregatedAccountReportsDao.updateMonth(clusterName, "2020-01"), null);
    assertEquals("Write failure count should be " + (writeFailureCountBefore + 1), writeFailureCountBefore + 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/AggregatedAccountReportsDaoTest.java