6
6
import com .itextpdf .kernel .pdf .PdfName ;
7
7
import com .itextpdf .kernel .pdf .PdfNumber ;
8
8
import com .itextpdf .kernel .pdf .PdfStream ;
9
+ import com .itextpdf .test .ExtendedITextTest ;
10
+ import com .itextpdf .test .annotations .type .IntegrationTest ;
9
11
10
- import junit .framework .TestCase ;
11
12
import org .junit .Assert ;
12
13
import org .junit .Test ;
14
+ import org .junit .experimental .categories .Category ;
13
15
14
- public class PdfFunctionFactoryTest extends TestCase {
16
+ @ Category (IntegrationTest .class )
17
+ public class PdfFunctionFactoryTest extends ExtendedITextTest {
15
18
16
19
@ Test
17
20
public void testCreateFunctionType0 () {
@@ -24,7 +27,7 @@ public void testCreateFunctionType0() {
24
27
stream .put (PdfName .BitsPerSample , new PdfNumber (1 ));
25
28
IPdfFunction function = PdfFunctionFactory .create (stream );
26
29
27
- assertTrue (function instanceof PdfType0Function );
30
+ Assert . assertTrue (function instanceof PdfType0Function );
28
31
}
29
32
30
33
@ Test
@@ -36,7 +39,7 @@ public void testCreateFunctionType2() {
36
39
object .put (PdfName .N , new PdfNumber (2 ));
37
40
IPdfFunction function = PdfFunctionFactory .create (object );
38
41
39
- assertTrue (function instanceof PdfType2Function );
42
+ Assert . assertTrue (function instanceof PdfType2Function );
40
43
}
41
44
42
45
@ Test
@@ -54,7 +57,7 @@ public void testCreateFunctionType3() {
54
57
object .put (PdfName .Encode , new PdfArray (new double [] {0 , 1 , 0 , 1 }));
55
58
IPdfFunction function = PdfFunctionFactory .create (object );
56
59
57
- assertTrue (function instanceof PdfType3Function );
60
+ Assert . assertTrue (function instanceof PdfType3Function );
58
61
}
59
62
60
63
@@ -69,7 +72,7 @@ public void testCreateFunctionType4() {
69
72
stream .put (PdfName .BitsPerSample , new PdfNumber (1 ));
70
73
IPdfFunction function = PdfFunctionFactory .create (stream );
71
74
72
- assertTrue (function instanceof PdfType4Function );
75
+ Assert . assertTrue (function instanceof PdfType4Function );
73
76
}
74
77
75
78
@@ -82,9 +85,9 @@ public void testInvalidFunctionTypeThrowsException() {
82
85
stream .put (PdfName .Range , new PdfArray (
83
86
new double [] {1 ,2 ,3 ,4 ,5 ,6 }));
84
87
stream .put (PdfName .BitsPerSample , new PdfNumber (1 ));
85
- PdfException ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (stream ));
88
+ Exception ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (stream ));
86
89
87
- assertEquals ("Invalid function type 1" , ex .getMessage ());
90
+ Assert . assertEquals ("Invalid function type 1" , ex .getMessage ());
88
91
}
89
92
90
93
@ Test
@@ -96,9 +99,9 @@ public void testDictionaryForType0Throws() {
96
99
dict .put (PdfName .Range , new PdfArray (
97
100
new double [] {1 ,2 ,3 ,4 ,5 ,6 }));
98
101
dict .put (PdfName .BitsPerSample , new PdfNumber (1 ));
99
- PdfException ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (dict ));
102
+ Exception ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (dict ));
100
103
101
- assertEquals ("Invalid object type, a function type 0 requires a stream object" , ex .getMessage ());
104
+ Assert . assertEquals ("Invalid object type, a function type 0 requires a stream object" , ex .getMessage ());
102
105
}
103
106
104
107
@ Test
@@ -110,16 +113,16 @@ public void testDictionaryForType4Throws() {
110
113
dict .put (PdfName .Range , new PdfArray (
111
114
new double [] {1 ,2 ,3 ,4 ,5 ,6 }));
112
115
dict .put (PdfName .BitsPerSample , new PdfNumber (1 ));
113
- PdfException ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (dict ));
116
+ Exception ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (dict ));
114
117
115
- assertEquals ("Invalid object type, a function type 4 requires a stream object" , ex .getMessage ());
118
+ Assert . assertEquals ("Invalid object type, a function type 4 requires a stream object" , ex .getMessage ());
116
119
}
117
120
118
121
@ Test
119
122
public void testArrayThrows () {
120
123
PdfArray array = new PdfArray ();
121
- PdfException ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (array ));
124
+ Exception ex = Assert .assertThrows (PdfException .class , () -> PdfFunctionFactory .create (array ));
122
125
123
- assertEquals ("Invalid object type, a function must be either a Dictionary or a Stream" , ex .getMessage ());
126
+ Assert . assertEquals ("Invalid object type, a function must be either a Dictionary or a Stream" , ex .getMessage ());
124
127
}
125
128
}
0 commit comments