private ImportLogBean createResume(int importType, Date date) {
   ImportLogBean importLogBean = new ImportLogBean(date, importType);
   // 1 = running
   importLogBean.setStatus(1);
   importLogDao.include(importLogBean);
   return importLogBean;
 }
  @Test
  public void shouldAlterFinalLog() {
    // given
    int importType = 0;
    Date currentDate = new GregorianCalendar(2009, 10, 12).getTime();

    ImportLogBean finalLog = new ImportLogBean(currentDate, importType);
    finalLog.setStatus(9);

    given(importLogDao.anyImportRunningOrRunnedToday(importType, currentDate)).willReturn(false);
    willAnswer(byCheckingLogEquals(finalLog)).given(importLogDao).alter(any(ImportLogBean.class));

    // when
    importManager.startImportProcess(importType, currentDate);

    // then
    verify(importLogDao).alter(any(ImportLogBean.class));
  }
    public void startImportProcess(int importType, Date date) {
      ImportLogBean importLogBean = null;

      try {
        importLogBean = createResume(importType, date);
        if (isOkToImport(importType, date)) {
          // get the right handler
          // importLogBean =
          // ImportHandlerFactory.singleton().getImportHandler(importType).processImport(importLogBean);
          // 2 = ok
          importLogBean.setStatus(2);
        } else {
          // 5 = failed - is there a running process
          importLogBean.setStatus(9);
        }
      } catch (Exception e) {
        // 9 = failed - exception
        if (importLogBean != null) importLogBean.setStatus(9);
      } finally {
        if (importLogBean != null) finalizeResume(importLogBean);
      }
    }