jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 03/07: Silence ErrorProne in test class
Date Sun, 21 Feb 2021 10:01:18 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 341977d2464d2c9682137689f45b44a8de814904
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sun Feb 21 10:33:43 2021 +0100

    Silence ErrorProne in test class
    
    Use ArrayDeque instead of LinkedList and make sure it is guarded
    against null elements.
    Make inner class static, because we can.
---
 .../java/org/apache/jorphan/gui/TableModelEventBacker.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/jorphan/src/test/java/org/apache/jorphan/gui/TableModelEventBacker.java b/src/jorphan/src/test/java/org/apache/jorphan/gui/TableModelEventBacker.java
index 9842649..051f414 100644
--- a/src/jorphan/src/test/java/org/apache/jorphan/gui/TableModelEventBacker.java
+++ b/src/jorphan/src/test/java/org/apache/jorphan/gui/TableModelEventBacker.java
@@ -21,9 +21,9 @@ import static java.lang.String.format;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
 
+import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Deque;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.function.ObjIntConsumer;
 import java.util.function.ToIntFunction;
@@ -39,7 +39,7 @@ public class TableModelEventBacker implements TableModelListener {
     /**
      * Makes assertions for a single {@link TableModelEvent}.
      */
-    public class EventAssertion {
+    public static class EventAssertion {
         private List<ObjIntConsumer<TableModelEvent>> assertions = new ArrayList<>();
 
         /**
@@ -118,14 +118,16 @@ public class TableModelEventBacker implements TableModelListener {
         }
     }
 
-    private Deque<TableModelEvent> events = new LinkedList<>();
+    private Deque<TableModelEvent> events = new ArrayDeque<>();
 
     /**
      * Stores event.
      */
     @Override
     public void tableChanged(TableModelEvent e) {
-        events.add(e);
+        if (e != null) {
+            events.add(e);
+        }
     }
 
     public Deque<TableModelEvent> getEvents() {


Mime
View raw message