remove unused imports and use diamond op
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/3bf930d8 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/3bf930d8 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/3bf930d8 Branch: refs/heads/master Commit: 3bf930d861cefcd6efc5e7585b2e0cd8f8ce3ed5 Parents: 2fdabc5 Author: Hayri Cicek <ha...@kodnito.com> Authored: Thu Dec 13 21:38:45 2018 +0100 Committer: Hayri Cicek <ha...@kodnito.com> Committed: Thu Dec 13 21:38:45 2018 +0100 ---------------------------------------------------------------------- .../org/apache/openejb/loader/FilesTest.java | 23 ++++++++++---------- .../apache/openejb/observer/EventSpeedTest.java | 6 ++--- .../openejb/observer/ObserverFeaturesTest.java | 4 ++-- .../openejb/observer/ObserverListTest.java | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/3bf930d8/container/openejb-loader/src/test/java/org/apache/openejb/loader/FilesTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-loader/src/test/java/org/apache/openejb/loader/FilesTest.java b/container/openejb-loader/src/test/java/org/apache/openejb/loader/FilesTest.java index 7430a5b..daca321 100644 --- a/container/openejb-loader/src/test/java/org/apache/openejb/loader/FilesTest.java +++ b/container/openejb-loader/src/test/java/org/apache/openejb/loader/FilesTest.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import java.util.logging.Level; -import java.util.logging.LogManager; import java.util.logging.Logger; import static org.junit.Assert.assertFalse; @@ -30,7 +29,7 @@ import static org.junit.Assert.assertTrue; public class FilesTest { - private final static File file = new File("target/test/foo.jar"); + private final static File FILE = new File("target/test/foo.jar"); @Test public void testDelete() throws Exception { @@ -49,26 +48,26 @@ public class FilesTest { for (int i = 0; i < 20; i++) { if (remove) { - Files.remove(file); + Files.remove(FILE); } else { - Files.delete(file); + Files.delete(FILE); } - Files.mkdirs(file.getParentFile()); - assertTrue(file.createNewFile()); - assertTrue(file.exists()); + Files.mkdirs(FILE.getParentFile()); + assertTrue(FILE.createNewFile()); + assertTrue(FILE.exists()); } - assertTrue(file.getParentFile().exists()); + assertTrue(FILE.getParentFile().exists()); if (remove) { - Files.remove(file.getParentFile()); + Files.remove(FILE.getParentFile()); } else { - Files.delete(file.getParentFile()); + Files.delete(FILE.getParentFile()); } - assertFalse(file.exists()); - assertFalse(file.getParentFile().exists()); + assertFalse(FILE.exists()); + assertFalse(FILE.getParentFile().exists()); final long time = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS); Logger.getLogger(this.getClass().getName()).log(Level.INFO, String.format("Completed File.%1$s in %2$sms" , remove ? "remove" : "delete", String.valueOf(time))); http://git-wip-us.apache.org/repos/asf/tomee/blob/3bf930d8/container/openejb-loader/src/test/java/org/apache/openejb/observer/EventSpeedTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-loader/src/test/java/org/apache/openejb/observer/EventSpeedTest.java b/container/openejb-loader/src/test/java/org/apache/openejb/observer/EventSpeedTest.java index 17e3b90..8db41ed 100644 --- a/container/openejb-loader/src/test/java/org/apache/openejb/observer/EventSpeedTest.java +++ b/container/openejb-loader/src/test/java/org/apache/openejb/observer/EventSpeedTest.java @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit; public class EventSpeedTest extends Assert { - private static final String format = "%10s %5s %5s %3.0f%%"; + private static final String FORMAT = "%10s %5s %5s %3.0f%%"; @Test public void test() throws Exception { @@ -31,7 +31,7 @@ public class EventSpeedTest extends Assert { final long start = System.nanoTime(); long events = 0; - System.out.println(String.format(format, "Events", "Obsvs", "Avg", 0d)); + System.out.println(String.format(FORMAT, "Events", "Obsvs", "Avg", 0d)); Stats previous = null; for (int i = 1; i < (64 / 4 + 1); i *= 2) { final Stats stats = time(i); @@ -108,7 +108,7 @@ public class EventSpeedTest extends Assert { public String compare(final Stats previous) { final double change = change(previous); - return String.format(format, events, observers, eventAverage(), change); + return String.format(FORMAT, events, observers, eventAverage(), change); } private double change(final Stats previous) { http://git-wip-us.apache.org/repos/asf/tomee/blob/3bf930d8/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverFeaturesTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverFeaturesTest.java b/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverFeaturesTest.java index e8b8983..212523d 100644 --- a/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverFeaturesTest.java +++ b/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverFeaturesTest.java @@ -314,8 +314,8 @@ public class ObserverFeaturesTest { }, 42); } - private final List<Boolean> conditions = new ArrayList<Boolean>(); - private final List<String> invocations = new ArrayList<String>(); + private final List<Boolean> conditions = new ArrayList<>(); + private final List<String> invocations = new ArrayList<>(); @Before public void init() { http://git-wip-us.apache.org/repos/asf/tomee/blob/3bf930d8/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverListTest.java ---------------------------------------------------------------------- diff --git a/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverListTest.java b/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverListTest.java index 8dc71fc..629acf7 100644 --- a/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverListTest.java +++ b/container/openejb-loader/src/test/java/org/apache/openejb/observer/ObserverListTest.java @@ -55,7 +55,7 @@ public class ObserverListTest { } }; - final List<String> invoked = new ArrayList<String>(); + final List<String> invoked = new ArrayList<>(); final ObserverManager observers = new ObserverManager(); observers.addObserver(new Object() { public void observe(@Observes final ObserverAdded o) {