forked from j62/ctbrec
Add test for Copy pp
This commit is contained in:
parent
02814440d2
commit
13783140e9
|
@ -0,0 +1,50 @@
|
||||||
|
package ctbrec.recorder.postprocessing;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import ctbrec.Config;
|
||||||
|
import ctbrec.Recording;
|
||||||
|
|
||||||
|
public class CopyTest extends AbstractPpTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCopySingleFile() throws IOException, InterruptedException {
|
||||||
|
Config config = mockConfig();
|
||||||
|
Recording rec = new Recording();
|
||||||
|
rec.setModel(mockModel());
|
||||||
|
rec.setAbsoluteFile(original);
|
||||||
|
rec.setStartDate(now);
|
||||||
|
rec.setSingleFile(false);
|
||||||
|
Copy pp = new Copy();
|
||||||
|
pp.postprocess(rec, recordingManager, config);
|
||||||
|
|
||||||
|
assertNotEquals(rec.getAbsoluteFile(), rec.getPostProcessedFile());
|
||||||
|
assertTrue(original.exists());
|
||||||
|
assertTrue(rec.getPostProcessedFile().exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCopyDirectory() throws IOException, InterruptedException {
|
||||||
|
Config config = mockConfig();
|
||||||
|
Recording rec = new Recording();
|
||||||
|
rec.setModel(mockModel());
|
||||||
|
rec.setAbsoluteFile(originalDir);
|
||||||
|
rec.setStartDate(now);
|
||||||
|
rec.setSingleFile(false);
|
||||||
|
Copy pp = new Copy();
|
||||||
|
pp.postprocess(rec, recordingManager, config);
|
||||||
|
|
||||||
|
assertNotEquals(rec.getAbsoluteFile(), rec.getPostProcessedFile());
|
||||||
|
assertTrue(originalDir.exists());
|
||||||
|
assertTrue(rec.getPostProcessedFile().exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetName() {
|
||||||
|
assertEquals("create a copy", new Copy().getName());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue