ANY23-358 fixed junit.framework.Assert & RDFa11Parser deprecation warnings
authorHans <firedrake93@gmail.com>
Mon, 9 Jul 2018 20:41:19 +0000 (15:41 -0500)
committerHans <firedrake93@gmail.com>
Mon, 9 Jul 2018 20:41:19 +0000 (15:41 -0500)
core/src/test/java/org/apache/any23/extractor/html/HCalendarExtractorTest.java
core/src/test/java/org/apache/any23/extractor/rdfa/RDFa11ParserTest.java
encoding/src/test/java/org/apache/any23/encoding/TikaEncodingDetectorTest.java

index 9b2e379..f54994e 100644 (file)
 
 package org.apache.any23.extractor.html;
 
-import junit.framework.Assert;
 import org.apache.any23.extractor.ExtractionException;
 import org.apache.any23.extractor.ExtractorFactory;
 import org.apache.any23.rdf.RDFUtils;
 import org.apache.any23.vocab.ICAL;
 import org.apache.any23.vocab.SINDICE;
+import org.junit.Assert;
 import org.junit.Test;
 import org.eclipse.rdf4j.model.Resource;
 import org.eclipse.rdf4j.model.Statement;
index c015e93..72d89c5 100644 (file)
@@ -37,7 +37,9 @@ import static org.mockito.Mockito.mock;
 
 /**
  * @author Michele Mostarda (mostarda@fbk.eu)
+ * @deprecated since 2.3
  */
+@Deprecated
 public class RDFa11ParserTest {
 
     @Test
index b99d47d..8ebd2ee 100644 (file)
@@ -17,7 +17,7 @@
 
 package org.apache.any23.encoding;
 
-import junit.framework.Assert;
+import org.junit.Assert;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -77,12 +77,9 @@ public class TikaEncodingDetectorTest {
     }
 
     private void assertEncoding(final String expected, final String resource) throws IOException {
-        InputStream fis = this.getClass().getResourceAsStream(resource);
-        try {
+        try (InputStream fis = getClass().getResourceAsStream(resource)) {
             String encoding = detector.guessEncoding(fis);
-            Assert.assertEquals( "Unexpected encoding", expected, encoding );
-        } finally {
-            fis.close();
+            Assert.assertEquals("Unexpected encoding", expected, encoding);
         }
     }