Skip to content

Commit 1ef7043

Browse files
author
Kate Ivanova
committed
Add test category
DEVSIX-3524
1 parent 1e32ca2 commit 1ef7043

File tree

5 files changed

+66
-44
lines changed

5 files changed

+66
-44
lines changed

io/src/test/java/com/itextpdf/io/codec/brotli/dec/DictionaryTest.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,34 @@
1111
import java.nio.ByteBuffer;
1212

1313
import com.itextpdf.test.ExtendedITextTest;
14+
import com.itextpdf.test.annotations.type.UnitTest;
15+
1416
import org.junit.Test;
17+
import org.junit.experimental.categories.Category;
1518
import org.junit.runner.RunWith;
1619
import org.junit.runners.JUnit4;
1720

1821
/**
1922
* Tests for {@link Dictionary}.
2023
*/
24+
@Category(UnitTest.class)
2125
@RunWith(JUnit4.class)
2226
public class DictionaryTest extends ExtendedITextTest {
2327

24-
private static long crc64(ByteBuffer data) {
25-
long crc = -1;
26-
for (int i = 0; i < data.capacity(); ++i) {
27-
long c = (crc ^ (long) (data.get(i) & 0xFF)) & 0xFF;
28-
for (int k = 0; k < 8; k++) {
29-
c = (c >>> 1) ^ (-(c & 1L) & -3932672073523589310L);
30-
}
31-
crc = c ^ (crc >>> 8);
28+
@Test
29+
public void testGetData() {
30+
assertEquals(37084801881332636L, crc64(Dictionary.getData()));
31+
}
32+
33+
private static long crc64(ByteBuffer data) {
34+
long crc = -1;
35+
for (int i = 0; i < data.capacity(); ++i) {
36+
long c = (crc ^ (long) (data.get(i) & 0xFF)) & 0xFF;
37+
for (int k = 0; k < 8; k++) {
38+
c = (c >>> 1) ^ (-(c & 1L) & -3932672073523589310L);
39+
}
40+
crc = c ^ (crc >>> 8);
41+
}
42+
return ~crc;
3243
}
33-
return ~crc;
34-
}
35-
36-
@Test
37-
public void testGetData() {
38-
assertEquals(37084801881332636L, crc64(Dictionary.getData()));
39-
}
40-
}
44+
}

io/src/test/java/com/itextpdf/io/codec/brotli/dec/EnumTest.java

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,47 @@
1515
import java.util.TreeSet;
1616

1717
import com.itextpdf.test.ExtendedITextTest;
18+
import com.itextpdf.test.annotations.type.UnitTest;
19+
1820
import org.junit.Test;
21+
import org.junit.experimental.categories.Category;
1922
import org.junit.runner.RunWith;
2023
import org.junit.runners.JUnit4;
2124

2225
/**
2326
* Tests for Enum-like classes.
2427
*/
28+
@Category(UnitTest.class)
2529
@RunWith(JUnit4.class)
2630
public class EnumTest extends ExtendedITextTest {
2731

28-
private void checkEnumClass(Class<?> clazz) {
29-
TreeSet<Integer> values = new TreeSet<Integer>();
30-
for (Field f : clazz.getDeclaredFields()) {
31-
assertEquals("int", f.getType().getName());
32-
assertEquals(Modifier.FINAL | Modifier.STATIC, f.getModifiers());
33-
Integer value = null;
34-
try {
35-
value = f.getInt(null);
36-
} catch (IllegalAccessException ex) {
37-
fail("Inaccessible field");
38-
}
39-
assertFalse(values.contains(value));
40-
values.add(value);
32+
@Test
33+
public void testRunningState() {
34+
checkEnumClass(RunningState.class);
35+
}
36+
37+
@Test
38+
public void testWordTransformType() {
39+
checkEnumClass(WordTransformType.class);
40+
}
41+
42+
private static void checkEnumClass(Class<?> clazz) {
43+
TreeSet<Integer> values = new TreeSet<Integer>();
44+
for (Field f : clazz.getDeclaredFields()) {
45+
if (!f.isSynthetic()) {
46+
assertEquals("int", f.getType().getName());
47+
assertEquals(Modifier.FINAL | Modifier.STATIC, f.getModifiers());
48+
Integer value = null;
49+
try {
50+
value = f.getInt(null);
51+
} catch (IllegalAccessException ex) {
52+
fail("Inaccessible field");
53+
}
54+
assertFalse(values.contains(value));
55+
values.add(value);
56+
}
57+
}
58+
assertEquals(0, values.first().intValue());
59+
assertEquals(values.size(), values.last() + 1);
4160
}
42-
assertEquals(0, values.first().intValue());
43-
assertEquals(values.size(), values.last() + 1);
44-
}
45-
46-
@Test
47-
public void testRunningState() {
48-
checkEnumClass(RunningState.class);
49-
}
50-
51-
@Test
52-
public void testWordTransformType() {
53-
checkEnumClass(WordTransformType.class);
54-
}
55-
}
61+
}

layout/src/test/java/com/itextpdf/layout/font/FontCharacteristicsTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ This file is part of the iText (R) project.
4343
package com.itextpdf.layout.font;
4444

4545
import com.itextpdf.test.ExtendedITextTest;
46+
import com.itextpdf.test.annotations.type.UnitTest;
47+
4648
import org.junit.Assert;
4749
import org.junit.Test;
50+
import org.junit.experimental.categories.Category;
4851

52+
@Category(UnitTest.class)
4953
public class FontCharacteristicsTest extends ExtendedITextTest {
5054
@Test
5155
public void testDefaultFontCharacteristics() {
@@ -239,4 +243,4 @@ public void testHashCode() {
239243
fontCharacteristics.setFontWeight((short) 800);
240244
Assert.assertNotEquals(fontCharacteristics.hashCode(), diffFontCharacteristics.hashCode());
241245
}
242-
}
246+
}

layout/src/test/java/com/itextpdf/layout/font/FontCharacteristicsUtilsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ This file is part of the iText (R) project.
4343
package com.itextpdf.layout.font;
4444

4545
import com.itextpdf.test.ExtendedITextTest;
46+
import com.itextpdf.test.annotations.type.UnitTest;
47+
4648
import org.junit.Assert;
4749
import org.junit.Test;
50+
import org.junit.experimental.categories.Category;
4851

52+
@Category(UnitTest.class)
4953
public class FontCharacteristicsUtilsTest extends ExtendedITextTest {
5054
@Test
5155
public void testNormalizingThinFontWeight() {

svg/src/test/java/com/itextpdf/svg/renderers/TransparencyTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ This file is part of the iText (R) project.
5656
import com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer;
5757
import com.itextpdf.svg.renderers.impl.CircleSvgNodeRenderer;
5858
import com.itextpdf.test.ExtendedITextTest;
59+
import com.itextpdf.test.annotations.type.IntegrationTest;
60+
5961
import org.junit.After;
6062
import org.junit.Assert;
6163
import org.junit.Before;
6264
import org.junit.Test;
6365

6466
import java.io.ByteArrayOutputStream;
67+
import org.junit.experimental.categories.Category;
6568

69+
@Category(IntegrationTest.class)
6670
public class TransparencyTest extends ExtendedITextTest {
6771

6872
private static final PdfName DEFAULT_RESOURCE_NAME = new PdfName("Gs1");

0 commit comments

Comments
 (0)