Index: trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java	(revision 17808)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java	(revision 17809)
@@ -46,13 +46,7 @@
 
         if (selected) {
-            if (s.selectedStyle == null) {
-                s.selectedStyle = new DividedScale<>();
-            }
-            s.selectedStyle.put(o, r);
+            s.selectedStyle = (s.selectedStyle == null ? new DividedScale<StyleElementList>() : s.selectedStyle).put(o, r);
         } else {
-            if (s.plainStyle == null) {
-                s.plainStyle = new DividedScale<>();
-            }
-            s.plainStyle.put(o, r);
+            s.plainStyle = (s.plainStyle == null ? new DividedScale<StyleElementList>() : s.plainStyle).put(o, r);
         }
         return s.intern();
@@ -82,10 +76,6 @@
     @Override
     public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
         final StyleCache other = (StyleCache) obj;
         return Objects.equals(plainStyle, other.plainStyle) && Objects.equals(selectedStyle, other.selectedStyle);
Index: trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java	(revision 17808)
+++ trunk/test/functional/org/openstreetmap/josm/gui/mappaint/StyleCacheTest.java	(revision 17809)
@@ -14,5 +14,4 @@
 
 import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -53,5 +52,5 @@
     @RegisterExtension
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules().preferences().projection().mapStyles().timeout(60000);
+    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().mapStyles().timeout(60000);
 
     /**
@@ -59,6 +58,6 @@
      * @throws Exception If an error occurred during load.
      */
-    @BeforeAll
-    public static void load() throws Exception {
+    @BeforeEach
+    public void load() throws Exception {
         img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
         try (InputStream in = Compression.getUncompressedFileInputStream(new File("nodist/data/neubrandenburg.osm.bz2"))) {
@@ -158,9 +157,5 @@
                 StyleElementList sel = p.a;
                 assertNotNull(sel);
-                Integer k = counter.get(sel);
-                if (k == null) {
-                    k = 0;
-                }
-                counter.put(sel, k + 1);
+                counter.merge(sel, 1, Integer::sum);
             }
         }
