-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathUtilityTest.java
More file actions
34 lines (30 loc) · 842 Bytes
/
Copy pathUtilityTest.java
File metadata and controls
34 lines (30 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package edu.abhi.poi.excel;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class UtilityTest {
private File tempFile;
@Before
public void setup() throws IOException{
tempFile = File.createTempFile("prefix-", "-suffix");
}
@After
public void tearDown(){
tempFile.delete();
}
@Test
public void deleteIfExistsNonExistingFileTest(){
assertTrue(tempFile.delete());
boolean result = Utility.deleteIfExists(tempFile);
assertFalse(result);
}
@Test
public void deleteIfExistsExistingFileTest(){
boolean result = Utility.deleteIfExists(tempFile);
assertTrue(result);
}
}