-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPDFValidatorTest.java
More file actions
35 lines (29 loc) · 879 Bytes
/
Copy pathPDFValidatorTest.java
File metadata and controls
35 lines (29 loc) · 879 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
35
import static io.github.multiform_validator.file.FileValidator.isValidPdf;
import static org.junit.jupiter.api.Assertions.*;
import java.io.File;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class PDFValidatorTest {
private String validPdfPath;
private String invalidPdfPath;
@BeforeEach
void setUp() {
String pdfBasePath = "src/test/java/assets/isValidPdf/";
validPdfPath = pdfBasePath + "valid.pdf";
invalidPdfPath = pdfBasePath + "invalid.pdf";
}
@Test
void testValidatePdf() {
File file = new File(validPdfPath);
assertTrue(isValidPdf(file));
}
@Test
void testValidatePdfWithInvalidPdf() {
File file = new File(invalidPdfPath);
assertFalse(isValidPdf(file));
}
@Test
void testValidatePdfWithNullFile() {
assertThrows(IllegalArgumentException.class, () -> isValidPdf(null));
}
}