@Test
public void testBackupDisabled(
        @Mocked IConfiguration configuration, @Mocked IBackupRestoreConfig backupRestoreConfig)
        throws Exception {

    new Expectations() {
        {
            backupRestoreConfig.getSnapshotMetaServiceCronExpression();
            result = "-1";
            configuration.getDataFileLocation();
            result = "target/data";
        }
    };
    Path dummyDataDirectoryLocation = Paths.get(configuration.getDataFileLocation());
    Instant snapshotInstant = DateUtil.getInstant();
    String snapshotName = snapshotMetaTask.generateSnapshotName(snapshotInstant);
    // Create one V2 snapshot.
    BackupFileUtils.generateDummyFiles(
            dummyDataDirectoryLocation,
            2,
            3,
            3,
            AbstractBackup.SNAPSHOT_FOLDER,
            snapshotName,
            true);
    // Create one V1 snapshot.
    String snapshotV1Name = DateUtil.formatInstant(DateUtil.yyyyMMdd, snapshotInstant);
    BackupFileUtils.generateDummyFiles(
            dummyDataDirectoryLocation,
            2,
            3,
            3,
            AbstractBackup.SNAPSHOT_FOLDER,
            snapshotV1Name,
            false);
    IService backupService =
            new BackupV2Service(
                    configuration,
                    backupRestoreConfig,
                    scheduler,
                    snapshotMetaTask,
                    cassandraTunerService);
    backupService.scheduleService();
    Assert.assertTrue(scheduler.getScheduler().getJobGroupNames().isEmpty());
    // snapshot V2 name should not be there.
    Set<Path> backupPaths =
            AbstractBackup.getBackupDirectories(configuration, AbstractBackup.SNAPSHOT_FOLDER);
    for (Path backupPath : backupPaths) {
        Assert.assertFalse(Files.exists(Paths.get(backupPath.toString(), snapshotName)));
        Assert.assertTrue(Files.exists(Paths.get(backupPath.toString(), snapshotV1Name)));
    }
}