You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/10/27 07:29:45 UTC

svn commit: r1882904 - /pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/afm/CharMetricTest.java

Author: lehmi
Date: Tue Oct 27 07:29:45 2020
New Revision: 1882904

URL: http://svn.apache.org/viewvc?rev=1882904&view=rev
Log:
PDFBOX-5001: sonar fix

Modified:
    pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/afm/CharMetricTest.java

Modified: pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/afm/CharMetricTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/afm/CharMetricTest.java?rev=1882904&r1=1882903&r2=1882904&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/afm/CharMetricTest.java (original)
+++ pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/afm/CharMetricTest.java Tue Oct 27 07:29:45 2020
@@ -20,6 +20,8 @@ package org.apache.fontbox.afm;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import java.util.List;
+
 import org.apache.fontbox.util.BoundingBox;
 import org.junit.Test;
 
@@ -77,12 +79,14 @@ public class CharMetricTest
         assertEquals(40, charMetric.getBoundingBox().getUpperRightY(), 0);
 
         assertEquals(0, charMetric.getLigatures().size());
-        charMetric.addLigature(new Ligature("successor", "ligature"));
-        assertEquals(1, charMetric.getLigatures().size());
-        assertEquals("successor", charMetric.getLigatures().get(0).getSuccessor());
+        Ligature ligature = new Ligature("successor", "ligature");
+        charMetric.addLigature(ligature);
+        List<Ligature> ligatures = charMetric.getLigatures();
+        assertEquals(1, ligatures.size());
+        assertEquals("successor", ligatures.get(0).getSuccessor());
         try
         {
-            charMetric.getLigatures().add(new Ligature("successor", "ligature"));
+            ligatures.add(ligature);
             fail("An UnsupportedOperationException should have been thrown");
         }
         catch (UnsupportedOperationException exception)