aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2019-12-27 23:00:13 +0000
committerAndreas Beeker <kiwiwings@apache.org>2019-12-27 23:00:13 +0000
commitc66575c1e7059ed403b74b76e699200fdee507b4 (patch)
tree0fe96421471b53e9f72a2370ce76d61b49a659bc /src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
parent37282aae8f25970b157c40ae0888684f974ba666 (diff)
downloadpoi-c66575c1e7059ed403b74b76e699200fdee507b4.tar.gz
poi-c66575c1e7059ed403b74b76e699200fdee507b4.zip
Migrate all junit tests to Junit 4
get rid of references to junit.framework don't throw AssertionFailedErrors, but use Assert.fail instead add try-with-resources where it was missing git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1872041 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java')
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java b/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
index 724d26432a..724ffb29d0 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestFontDetails.java
@@ -17,38 +17,41 @@
package org.apache.poi.hssf.usermodel;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
import java.util.Properties;
+import org.junit.Before;
+import org.junit.Test;
+
/**
* Tests the implementation of the FontDetails class.
- *
- * @author Glen Stampoultzis (glens at apache.org)
*/
-public final class TestFontDetails extends TestCase {
- private Properties properties;
+public final class TestFontDetails {
private FontDetails fontDetails;
- @Override
- protected void setUp() {
- properties = new Properties();
+ @Before
+ public void setUp() {
+ Properties properties = new Properties();
properties.setProperty("font.Arial.height", "13");
properties.setProperty("font.Arial.characters", "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ");
- properties.setProperty("font.Arial.widths", "6, 6, 6, 6, 6, 3, 6, 6, 3, 4, 6, 3, 9, 6, 6, 6, 6, 4, 6, 3, 6, 7, 9, 6, 5, 5, 7, 7, 7, 7, 7, 6, 8, 7, 3, 6, 7, 6, 9, 7, 8, 7, 8, 7, 7, 5, 7, 7, 9, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, ");
+ properties.setProperty("font.Arial.widths", "6, 6, 6, 6, 6, 3, 6, 6, 3, 4, 6, 3, 9, 6, 6, 6, 6, 4, 6, 3, 6, 7, 9, 6, 5, 5, 7, 7, 7, 7, 7, 6, 8, 7, 3, 6, 7, 6, 9, 7, 8, 7, 8, 7, 7, 5, 7, 7, 9, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, ");
fontDetails = FontDetails.create("Arial", properties);
}
+ @Test
public void testCreate() {
assertEquals(13, fontDetails.getHeight());
assertEquals(6, fontDetails.getCharWidth('a'));
assertEquals(3, fontDetails.getCharWidth('f'));
}
+ @Test
public void testGetStringWidth() {
assertEquals(9, fontDetails.getStringWidth("af"));
}
+ @Test
public void testGetCharWidth() {
assertEquals(6, fontDetails.getCharWidth('a'));
assertEquals(9, fontDetails.getCharWidth('='));