package ctbrec.recorder.postprocessing;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collections;

import org.junit.Test;

import ctbrec.Config;
import ctbrec.Recording;
import ctbrec.recorder.RecordingManager;

public class RemoveKeepFileTest extends AbstractPpTest {

    @Test
    public void testPostProcessWithSingleFile() throws IOException, InterruptedException {
        Recording rec = new Recording();
        rec.setModel(mockModel());
        rec.setAbsoluteFile(original);
        rec.setPostProcessedFile(postProcessed);
        rec.setStartDate(now);
        rec.setSingleFile(true);

        Config config = mockConfig();
        RecordingManager rm = new RecordingManager(config, Collections.emptyList());
        rm.add(rec);
        assertTrue(rm.getAll().size() == 1);
        RemoveKeepFile pp = new RemoveKeepFile();
        pp.postprocess(rec, rm, config);

        assertTrue(rec.getAbsoluteFile().exists());
        assertTrue(rec.getPostProcessedFile().exists());
        assertTrue(rm.getAll().isEmpty());
    }

    @Test
    public void testGetName() {
        assertEquals("remove recording, but keep the files", new RemoveKeepFile().getName());
    }

}
