### Question:
BackupDbUtil { public void doBackup(BlockCapsule block) { long t1 = System.currentTimeMillis(); try { switch (State.valueOf(getBackupState())) { case BAKINGONE: deleteBackup(DB_BACKUP_INDEX1); backup(DB_BACKUP_INDEX1); switchBackupState(); deleteBackup(DB_BACKUP_INDEX2); break; case BAKEDONE: deleteBackup(DB_BACKUP_INDEX2); backup(DB_BACKUP_INDEX2); switchBackupState(); deleteBackup(DB_BACKUP_INDEX1); break; case BAKINGTWO: deleteBackup(DB_BACKUP_INDEX2); backup(DB_BACKUP_INDEX2); switchBackupState(); deleteBackup(DB_BACKUP_INDEX1); break; case BAKEDTWO: deleteBackup(DB_BACKUP_INDEX1); backup(DB_BACKUP_INDEX1); switchBackupState(); deleteBackup(DB_BACKUP_INDEX2); break; default: logger.warn("invalid backup state"); } } catch (RocksDBException | SecurityException e) { logger.warn("backup db error:" + e); } long timeUsed = System.currentTimeMillis() - t1; logger .info("current block number is {}, backup all store use {} ms!", block.getNum(), timeUsed); if (timeUsed >= 3000) { logger.warn("backup db use too much time."); } }  void doBackup(BlockCapsule block);  }### Answer:
@Test public void testDoBackup() { PropUtil.writeProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE(), String.valueOf("11")); mngForTest.pushNTestBlock(50); List<Chainbase> alist = ((SnapshotManager) dbBackupUtil.getDb()).getDbs(); Assert.assertTrue(dbManager.getDynamicPropertiesStore().getLatestBlockHeaderNumber() == 50); Assert.assertTrue("22".equals( PropUtil.readProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE()))); mngForTest.pushNTestBlock(50); Assert.assertTrue(dbManager.getDynamicPropertiesStore().getLatestBlockHeaderNumber() == 100); Assert.assertTrue("11".equals( PropUtil.readProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE()))); mngForTest.pushNTestBlock(50); Assert.assertTrue(dbManager.getDynamicPropertiesStore().getLatestBlockHeaderNumber() == 150); Assert.assertTrue("22".equals( PropUtil.readProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE()))); PropUtil.writeProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE(), String.valueOf("1")); mngForTest.pushNTestBlock(50); Assert.assertTrue(dbManager.getDynamicPropertiesStore().getLatestBlockHeaderNumber() == 200); Assert.assertTrue("11".equals( PropUtil.readProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE()))); PropUtil.writeProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE(), String.valueOf("2")); mngForTest.pushNTestBlock(50); Assert.assertTrue(dbManager.getDynamicPropertiesStore().getLatestBlockHeaderNumber() == 250); Assert.assertTrue("22".equals( PropUtil.readProperty(propPath, BackupDbUtil.getDB_BACKUP_STATE()))); }