From f6e8dc984503a8a1d4349766644655a33b053df8 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Thu, 19 Jul 2018 09:57:57 +0200 Subject: [PATCH] HHH-12828 Make ScannerTests more stable In a shared containerized environment like Travis, it's not obvious that the second read will be faster than the first one. And indeed, the test often fails. There's no real value in testing that, we are just testing I/O, and the OS cache. --- .../org/jboss/as/jpa/hibernate5/scan/ScannerTests.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hibernate-jipijapa/src/test/java/org/jboss/as/jpa/hibernate5/scan/ScannerTests.java b/hibernate-jipijapa/src/test/java/org/jboss/as/jpa/hibernate5/scan/ScannerTests.java index 2bd333984e..5a40e079a8 100644 --- a/hibernate-jipijapa/src/test/java/org/jboss/as/jpa/hibernate5/scan/ScannerTests.java +++ b/hibernate-jipijapa/src/test/java/org/jboss/as/jpa/hibernate5/scan/ScannerTests.java @@ -7,7 +7,6 @@ package org.jboss.as.jpa.hibernate5.scan; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.BufferedInputStream; @@ -23,14 +22,12 @@ import java.nio.file.Paths; import java.util.concurrent.ScheduledThreadPoolExecutor; import org.hibernate.boot.archive.internal.ArchiveHelper; - import org.jboss.shrinkwrap.api.ArchivePath; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.exporter.ZipExporter; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.vfs.TempFileProvider; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -128,21 +125,16 @@ public class ScannerTests { public void testGetBytesFromInputStream() throws Exception { File file = buildLargeJar(); - long start = System.currentTimeMillis(); InputStream stream = new BufferedInputStream( new FileInputStream( file ) ); int oldLength = getBytesFromInputStream( stream ).length; stream.close(); - long oldTime = System.currentTimeMillis() - start; - start = System.currentTimeMillis(); stream = new BufferedInputStream( new FileInputStream( file ) ); int newLength = ArchiveHelper.getBytesFromInputStream( stream ).length; stream.close(); - long newTime = System.currentTimeMillis() - start; assertEquals( oldLength, newLength ); - assertTrue( oldTime > newTime ); } // This is the old getBytesFromInputStream from JarVisitorFactory before