Author: tilman
Date: Mon Apr  7 09:20:38 2025
New Revision: 1924893

URL: http://svn.apache.org/viewvc?rev=1924893&view=rev
Log:
PDFBOX-5660: Sonar fix

Modified:
    
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSStream.java
    
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
    
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
    
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElementTest.java
    
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItemIteratorTest.java

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSStream.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSStream.java?rev=1924893&r1=1924892&r2=1924893&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSStream.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSStream.java
 Mon Apr  7 09:20:38 2025
@@ -167,7 +167,7 @@ class TestCOSStream
         try (COSStream stream = new COSStream())
         {
             assertFalse(stream.hasData());
-            Assertions.assertThrows(IOException.class, () -> 
stream.createInputStream(),
+            Assertions.assertThrows(IOException.class, 
stream::createInputStream,
                 "createInputStream should have thrown an IOException");
 
             byte[] testString = "This is a test string to be used as input for 
TestCOSStream"

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java?rev=1924893&r1=1924892&r2=1924893&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
 Mon Apr  7 09:20:38 2025
@@ -1344,7 +1344,7 @@ class PDFMergerUtilityTest
             annotations = doc.getPage(1).getAnnotations();
             assertEquals(1, annotations.size());
             PDAnnotationLink link = (PDAnnotationLink) annotations.get(0);
-            assertThrows(IOException.class, () -> link.getDestination());
+            assertThrows(IOException.class, link::getDestination);
         }
     }
 

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java?rev=1924893&r1=1924892&r2=1924893&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDPageContentStream.java
 Mon Apr  7 09:20:38 2025
@@ -252,31 +252,18 @@ class TestPDPageContentStream
             Assertions.assertThrows(IllegalStateException.class,
                     () -> contentStream.lineTo(1, 1));
             Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.stroke());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.closeAndStroke());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.closeAndFillAndStroke());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.closeAndFillAndStrokeEvenOdd());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.fill());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.fillAndStroke());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.fillAndStrokeEvenOdd());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.fillEvenOdd());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.fill());
-            Assertions.assertThrows(IllegalStateException.class,
                     () -> contentStream.shadingFill(new PDShadingType1(new 
COSDictionary())));
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.closePath());
-            Assertions.assertThrows(IllegalStateException.class, 
-                    () -> contentStream.clip());
-            Assertions.assertThrows(IllegalStateException.class,
-                    () -> contentStream.clipEvenOdd());
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::stroke);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::closeAndStroke);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::closeAndFillAndStroke);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::closeAndFillAndStrokeEvenOdd);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::fill);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::fillAndStroke);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::fillAndStrokeEvenOdd);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::fillEvenOdd);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::closePath);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::clip);
+            Assertions.assertThrows(IllegalStateException.class, 
contentStream::clipEvenOdd);
             
             // J
             contentStream.setLineCapStyle(0);

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElementTest.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElementTest.java?rev=1924893&r1=1924892&r2=1924893&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElementTest.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElementTest.java
 Mon Apr  7 09:20:38 2025
@@ -61,7 +61,7 @@ class PDStructureElementTest
 
         // collect attributes and check their count.
         assertEquals(117, attributeSet.size());
-        int cnt = attributeSet.stream().map(attributes -> 
attributes.size()).reduce(0, Integer::sum);
+        int cnt = attributeSet.stream().map(Revisions::size).reduce(0, 
Integer::sum);
         assertEquals(111, cnt); // this one was 105 before PDFBOX-4197 was 
fixed
         assertEquals(0, classSet.size());
     }
@@ -86,7 +86,7 @@ class PDStructureElementTest
 
         // collect attributes and check their count.
         assertEquals(72, attributeSet.size());
-        int cnt = attributeSet.stream().map(attributes -> 
attributes.size()).reduce(0, Integer::sum);
+        int cnt = attributeSet.stream().map(Revisions::size).reduce(0, 
Integer::sum);
         assertEquals(45, cnt);
         assertEquals(10, classSet.size());
     }

Modified: 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItemIteratorTest.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItemIteratorTest.java?rev=1924893&r1=1924892&r2=1924893&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItemIteratorTest.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/interactive/documentnavigation/outline/PDOutlineItemIteratorTest.java
 Mon Apr  7 09:20:38 2025
@@ -58,7 +58,7 @@ class PDOutlineItemIteratorTest
     void removeUnsupported()
     {
         PDOutlineItemIterator pdOutlineItemIterator = new 
PDOutlineItemIterator(new PDOutlineItem());
-        assertThrows(UnsupportedOperationException.class, () -> 
pdOutlineItemIterator.remove());
+        assertThrows(UnsupportedOperationException.class, 
pdOutlineItemIterator::remove);
     }
 
     @Test


Reply via email to