@Test(expected = RuntimeException.class)
public void testSaveFailure() throws Exception {

  doThrow(new RuntimeException())
      .when(repository)
      .update(any(MysqlSourceState.class), any(Repository.DataUpdater.class));
  try {
    stateRepository.save(mock(MysqlSourceState.class));
  } catch (RuntimeException ex) {
    verify(metrics, times(1)).stateSaveFailure(any(Exception.class));
    throw ex;
  }
}