Changeset 8450 in josm for trunk


Ignore:
Timestamp:
2015-06-03T01:27:41+02:00 (10 years ago)
Author:
Don-vip
Message:

unit tests - simplify assertions

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r8303 r8450  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.junit.Assert.assertSame;
    45import static org.junit.Assert.assertTrue;
    56
     
    9899        // Expected result: Dataset contain one closed way, clockwise
    99100        Collection<Way> resultingWays = dataSet.getWays();
    100         assertTrue(String.format("Expect one way after perform action. %d found",
    101                                  resultingWays.size()),
    102                    resultingWays.size() == 1);
     101        assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()),
     102                   resultingWays.size(), 1);
    103103        Way resultingWay = resultingWays.iterator().next();
    104104        assertTrue("Resulting way is not closed",
     
    174174        // Expected result: Dataset contain one closed way, clockwise
    175175        Collection<Way> resultingWays = dataSet.getWays();
    176         assertTrue(String.format("Expect one way after perform action. %d found",
    177                                  resultingWays.size()),
    178                    resultingWays.size() == 1);
     176        assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()),
     177                   resultingWays.size(), 1);
    179178        Way resultingWay = resultingWays.iterator().next();
    180179        assertTrue("Resulting way is not closed",
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r8276 r8450  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.junit.Assert.assertSame;
    45import static org.junit.Assert.assertTrue;
    56
     
    8081
    8182        // Ensures 3 ways.
    82         assertTrue(String.format("Found %d ways after split action instead of 3.",
    83                                  dataSet.getWays().size()),
    84                    dataSet.getWays().size() == 3);
     83        assertSame(String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size()),
     84                   dataSet.getWays().size(), 3);
    8585
    8686        // Ensures way w1 is unchanged.
    8787        assertTrue("Unselected ways disappear during split action.",
    8888                   dataSet.getWays().contains(w1));
    89         assertTrue("Unselected way seems to have change during split action.",
    90                    w1.getNodesCount() == 3);
     89        assertSame("Unselected way seems to have change during split action.",
     90                   w1.getNodesCount(), 3);
    9191        for(int i = 0; i < 3; i++) {
    92             assertTrue("Node change in unselected way during split action.",
    93                        w1.getNode(i) == w1NodesArray[i]);
     92            assertSame("Node change in unselected way during split action.",
     93                       w1.getNode(i), w1NodesArray[i]);
    9494        }
    9595    }
  • trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java

    r8294 r8450  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.Assert.assertFalse;
    55
    66import java.util.Arrays;
     
    3232        public void notify(String msg, int messageType) {
    3333            return;
    34         };
     34        }
    3535    }
    3636
     
    8282
    8383        // Ensures node n2 remove from w
    84         assertTrue("Node n2 wasn't removed from way w.",
    85                    !w.containsNode(n2));
     84        assertFalse("Node n2 wasn't removed from way w.", w.containsNode(n2));
    8685    }
    8786}
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java

    r8343 r8450  
    22package org.openstreetmap.josm.actions.mapmode;
    33
     4import static org.junit.Assert.assertFalse;
     5import static org.junit.Assert.assertSame;
    46import static org.junit.Assert.assertTrue;
     7import static org.junit.Assert.fail;
    58
    69import java.awt.Cursor;
     
    4346            this.currentDataSet = dataSet;
    4447        };
     48        @Override
    4549        public EastNorth getEastNorth(int x, int y) {
    4650            return new EastNorth(x, y);
    4751        }
     52        @Override
    4853        public void addMouseListener(MouseListener ml) {}
     54        @Override
    4955        public void removeMouseListener(MouseListener ml) {}
    5056        public void addMouseMotionListener(MouseListener ml) {}
    5157        public void removeMouseMotionListener(MouseListener ml) {}
    5258        public void mvRepaint() {}
     59        @Override
    5360        public void setVirtualNodesEnabled(boolean enabled) {}
     61        @Override
    5462        public void setNewCursor(Cursor cursor, Object reference) {}
     63        @Override
    5564        public void setNewCursor(int cursor, Object reference) {}
     65        @Override
    5666        public boolean isActiveLayerVisible() {
    5767            return true;
     
    6474                }
    6575            };
     76        @Override
    6677        public void requestClearRect() {}
     78        @Override
    6779        public Point2D getPoint2D(EastNorth p) {
    6880            return new Point2D.Double(p.getX(), p.getY());
    6981        }
     82        @Override
    7083        public void setActiveLayer(Layer layer) {}
     84        @Override
    7185        public Layer getActiveLayer() {
    7286            return layer;
    7387        }
     88        @Override
    7489        protected DataSet getCurrentDataSet() {
    7590            return currentDataSet;
     
    8196     */
    8297    class PreferencesMock extends Preferences {
     98        @Override
    8399        public synchronized int getInteger(String key, int def) {
    84100            if (key == "edit.initial-move-delay") {
     
    101117            } catch (Exception e) {
    102118                e.printStackTrace();
    103                 assertTrue("Can't setup testing environnement", false);
     119                fail("Can't setup testing environnement");
    104120            }
    105121        }
     122        @Override
    106123        public void mergeNodes(OsmDataLayer layer, Collection<Node> nodes,
    107124                               Node targetLocationNode) {
    108             assertTrue(String.format("Should merge two nodes, %d found",
    109                                      nodes.size()),
    110                        nodes.size() == 2);
     125            assertSame(String.format("Should merge two nodes, %d found", nodes.size()),
     126                       nodes.size(), 2);
    111127            nodesMerged = true;
    112128        }
     
    182198        // As result of test, we must find a 2 nodes way, from EN(0, 0) to EN(100, 0)
    183199        assertTrue("Nodes are not merged", nodesMerged);
    184         assertTrue(String.format("Expect exactly one way, found %d\n",
    185                                  dataSet.getWays().size()),
    186                    dataSet.getWays().size() == 1);
     200        assertSame(String.format("Expect exactly one way, found %d\n", dataSet.getWays().size()),
     201                   dataSet.getWays().size(), 1);
    187202        Way rw = dataSet.getWays().iterator().next();
    188         assertTrue("Way shouldn't be deleted\n",
    189                    !rw.isDeleted());
    190         assertTrue(String.format("Way shouldn't have 2 nodes, %d found\n",
    191                                  w.getNodesCount()),
    192                    rw.getNodesCount() == 2);
     203        assertFalse("Way shouldn't be deleted\n", rw.isDeleted());
     204        assertSame(String.format("Way shouldn't have 2 nodes, %d found\n", w.getNodesCount()),
     205                   rw.getNodesCount(), 2);
    193206        Node r1 = rw.firstNode();
    194207        Node r2 = rw.lastNode();
     
    198211            r2 = tmp;
    199212        }
    200         assertTrue(String.format("East should be 0, found %f\n",
    201                                  r1.getEastNorth().east()),
    202                    Double.compare(r1.getEastNorth().east(), 0) == 0);
    203         assertTrue(String.format("East should be 100, found %f\n",
    204                                  r2.getEastNorth().east()),
    205                    Double.compare(r2.getEastNorth().east(), 100) == 0);
     213        assertSame(String.format("East should be 0, found %f\n", r1.getEastNorth().east()),
     214                   Double.compare(r1.getEastNorth().east(), 0), 0);
     215        assertSame(String.format("East should be 100, found %f\n", r2.getEastNorth().east()),
     216                   Double.compare(r2.getEastNorth().east(), 100), 0);
    206217    }
    207218}
  • trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java

    r7937 r8450  
    11package org.openstreetmap.josm.data;
     2
     3import static org.junit.Assert.assertEquals;
     4import static org.junit.Assert.assertFalse;
     5import static org.junit.Assert.assertTrue;
    26
    37import org.junit.Test;
    48import org.openstreetmap.josm.data.coor.LatLon;
    5 
    6 import static org.junit.Assert.assertTrue;
    79
    810public class BoundsTest {
     
    1214        Bounds b1 = new Bounds(0, 170, 50, -170);
    1315        assertTrue(b1.crosses180thMeridian());
    14         assertTrue(!b1.contains(new LatLon(-10, -180)));
     16        assertFalse(b1.contains(new LatLon(-10, -180)));
    1517        assertTrue(b1.contains(new LatLon(0, -180)));
    1618        assertTrue(b1.contains(new LatLon(50, -180)));
    17         assertTrue(!b1.contains(new LatLon(60, -180)));
    18         assertTrue(!b1.contains(new LatLon(-10, 180)));
     19        assertFalse(b1.contains(new LatLon(60, -180)));
     20        assertFalse(b1.contains(new LatLon(-10, 180)));
    1921        assertTrue(b1.contains(new LatLon(0, 180)));
    2022        assertTrue(b1.contains(new LatLon(50, 180)));
    21         assertTrue(!b1.contains(new LatLon(60, 180)));
     23        assertFalse(b1.contains(new LatLon(60, 180)));
    2224
    2325        Bounds b2 = new Bounds(60, 170, 90, -170);
    24         assertTrue(!b1.intersects(b2));
    25         assertTrue(!b2.intersects(b1));
     26        assertFalse(b1.intersects(b2));
     27        assertFalse(b2.intersects(b1));
    2628
    2729        Bounds b3 = new Bounds(25, 170, 90, -170);
     
    3032        assertTrue(b2.intersects(b3));
    3133        assertTrue(b3.intersects(b2));
    32        
     34
    3335        b3.extend(b1);
    34         assertTrue(b3.equals(new Bounds(0, 170, 90, -170)));
     36        assertEquals(b3, new Bounds(0, 170, 90, -170));
    3537        assertTrue(b1.intersects(b3));
    3638        assertTrue(b3.intersects(b1));
    3739        assertTrue(b2.intersects(b3));
    3840        assertTrue(b3.intersects(b2));
    39        
     41
    4042        b3.extend(new LatLon(0, 0));
    41         assertTrue(b3.equals(new Bounds(0, 0, 90, -170)));
     43        assertEquals(b3, new Bounds(0, 0, 90, -170));
    4244    }
    4345}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java

    r7937 r8450  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
    56import static org.junit.Assert.fail;
    67
     
    139140
    140141        assertEquals(3, toAdd.size());
    141         assertEquals(true, toAdd.indexOf(r2) < toAdd.indexOf(r1));
    142         assertEquals(true, toAdd.indexOf(r3) < toAdd.indexOf(r1));
     142        assertTrue(toAdd.indexOf(r2) < toAdd.indexOf(r1));
     143        assertTrue(toAdd.indexOf(r3) < toAdd.indexOf(r1));
    143144    }
    144145
     
    186187
    187188        assertEquals(4, toDelete.size());
    188         assertEquals(true, toDelete.indexOf(r2) < toDelete.indexOf(r1));
    189         assertEquals(true, toDelete.indexOf(r3) < toDelete.indexOf(r1));
     189        assertTrue(toDelete.indexOf(r2) < toDelete.indexOf(r1));
     190        assertTrue(toDelete.indexOf(r3) < toDelete.indexOf(r1));
    190191    }
    191192
     
    226227
    227228        assertEquals(4, toDelete.size());
    228         assertEquals(true, toDelete.indexOf(way) < toDelete.indexOf(n1));
    229         assertEquals(true, toDelete.indexOf(way) < toDelete.indexOf(n2));
    230         assertEquals(true, toDelete.indexOf(r1) < toDelete.indexOf(way));
     229        assertTrue(toDelete.indexOf(way) < toDelete.indexOf(n1));
     230        assertTrue(toDelete.indexOf(way) < toDelete.indexOf(n2));
     231        assertTrue(toDelete.indexOf(r1) < toDelete.indexOf(way));
    231232    }
    232233
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java

    r7937 r8450  
    55import static org.junit.Assert.assertFalse;
    66import static org.junit.Assert.assertNotNull;
     7import static org.junit.Assert.assertNotSame;
     8import static org.junit.Assert.assertSame;
    79import static org.junit.Assert.assertTrue;
    810
     
    9193        Node n2 = (Node)my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    9294        assertTrue(visitor.getConflicts().isEmpty());
    93         assertTrue(n1 != n2); // make sure we have a clone
     95        assertNotSame(n1, n2); // make sure we have a clone
    9496        assertEquals(1, n2.getId());
    9597        assertEquals(1, n2.getVersion());
    96         assertEquals(false, n2.isModified());
     98        assertFalse(n2.isModified());
    9799        assertEquals("value1", n2.get("key1"));
    98100
    99101        // merge target not modified after merging
    100         assertTrue(!n2.isModified());
     102        assertFalse(n2.isModified());
    101103    }
    102104
     
    127129        Node n2 = (Node)my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    128130        assertTrue(visitor.getConflicts().isEmpty());
    129         assertTrue(n == n2); // make sure the merged node is still the original node
    130         assertTrue(n2.getDataSet() == my);
     131        assertSame(n, n2); // make sure the merged node is still the original node
     132        assertSame(n2.getDataSet(), my);
    131133        assertEquals(1, n2.getId());
    132134        assertEquals(2, n2.getVersion());
    133         assertEquals(false, n2.isModified());
     135        assertFalse(n2.isModified());
    134136        assertEquals("value1-new", n2.get("key1"));
    135137        assertEquals("value2", n2.get("key2"));
    136138
    137139        // the merge target should not be modified
    138         assertTrue(!n2.isModified());
     140        assertFalse(n2.isModified());
    139141    }
    140142
     
    168170        Node n2 = (Node)my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    169171        assertEquals(1,visitor.getConflicts().size());
    170         assertTrue(n == n2);
    171         assertTrue(n1 != n2);
    172         assertTrue(n1.getDataSet() == their);
     172        assertSame(n, n2);
     173        assertNotSame(n1, n2);
     174        assertSame(n1.getDataSet(), their);
    173175    }
    174176
     
    201203        Node n2 = (Node)my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    202204        assertEquals(1,visitor.getConflicts().size());
    203         assertTrue(n == n2);
    204         assertTrue(n1 != n2);
    205         assertTrue(n1.getDataSet() == their);
     205        assertSame(n, n2);
     206        assertNotSame(n1, n2);
     207        assertSame(n1.getDataSet(), their);
    206208    }
    207209
     
    228230        Node n2 = (Node)my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    229231        assertEquals(0,visitor.getConflicts().size());
    230         assertEquals(true, n2.isVisible());
    231         assertTrue(n == n2);
    232         assertTrue(n.getDataSet() == my);
    233         assertTrue(n1.getDataSet() == their);
     232        assertTrue(n2.isVisible());
     233        assertSame(n, n2);
     234        assertSame(n.getDataSet(), my);
     235        assertSame(n1.getDataSet(), their);
    234236    }
    235237
     
    253255
    254256        assertEquals(0, visitor.getConflicts().size());
    255         assertTrue(n.getDataSet() == my);
    256         assertTrue(n1.getDataSet() == their);
     257        assertSame(n.getDataSet(), my);
     258        assertSame(n1.getDataSet(), their);
    257259    }
    258260
     
    279281        assertEquals(0,visitor.getConflicts().size());
    280282        Node n2 = (Node)my.getNodes().toArray()[0];
    281         assertTrue(n2 == n);
     283        assertSame(n2, n);
    282284        assertTrue(n2.isDeleted());
    283285    }
     
    322324        assertEquals(0,visitor.getConflicts().size());
    323325        assertEquals("value1",n2.get("key1"));
    324         assertEquals(true, n1.getTimestamp().equals(n2.getTimestamp()));
     326        assertTrue(n1.getTimestamp().equals(n2.getTimestamp()));
    325327        assertEquals(theirUser,n2.getUser());
    326         assertTrue(n2 == n);
    327         assertTrue(n2 != n1);
    328         assertTrue(n2.getDataSet() == my);
     328        assertSame(n2, n);
     329        assertNotSame(n2, n1);
     330        assertSame(n2.getDataSet(), my);
    329331    }
    330332
     
    356358        assertEquals(0,visitor.getConflicts().size());
    357359        assertEquals("value1",n2.get("key1"));
    358         assertEquals(true, n1.getTimestamp().equals(n2.getTimestamp()));
    359         assertEquals(false, n2.isIncomplete());
    360         assertTrue(n2 == n);
     360        assertTrue(n1.getTimestamp().equals(n2.getTimestamp()));
     361        assertFalse(n2.isIncomplete());
     362        assertSame(n2, n);
    361363    }
    362364
     
    423425        assertEquals(1,merged.getNode(0).getId());
    424426        assertEquals(2,merged.getNode(1).getId());
    425         assertTrue(merged == myWay);
    426         assertTrue(merged.getDataSet() == my);
     427        assertSame(merged, myWay);
     428        assertSame(merged.getDataSet(), my);
    427429
    428430        Node mergedNode = (Node)my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    429         assertTrue(mergedNode == n1);
     431        assertSame(mergedNode, n1);
    430432        mergedNode = (Node)my.getPrimitiveById(2, OsmPrimitiveType.NODE);
    431         assertTrue(mergedNode == n2);
    432 
    433         assertTrue(!merged.isModified());
     433        assertSame(mergedNode, n2);
     434
     435        assertFalse(merged.isModified());
    434436    }
    435437
     
    498500        assertEquals("value1",merged.getNode(2).get("key1"));
    499501
    500         assertTrue(merged.getNode(0) == n1);
    501         assertTrue(merged.getNode(1) != n5); // must be clone of the original node in their
    502         assertTrue(merged.getNode(2) == n2);
    503 
    504         assertTrue(!merged.isModified());  // the target wasn't modified before merging, it
    505         // mustn't be after merging
     502        assertSame(merged.getNode(0), n1);
     503        assertNotSame(merged.getNode(1), n5); // must be clone of the original node in their
     504        assertSame(merged.getNode(2), n2);
     505
     506        assertFalse(merged.isModified());  // the target wasn't modified before merging, it mustn't be after merging
    506507    }
    507508
     
    613614        Way merged = (Way)my.getPrimitiveById(3, OsmPrimitiveType.WAY);
    614615        assertEquals(1,visitor.getConflicts().size());
    615         assertEquals(true, visitor.getConflicts().hasConflictForMy(myWay));
    616         assertEquals(true, visitor.getConflicts().hasConflictForTheir(theirWay));
     616        assertTrue(visitor.getConflicts().hasConflictForMy(myWay));
     617        assertTrue(visitor.getConflicts().hasConflictForTheir(theirWay));
    617618        assertEquals(myWay,merged);
    618619    }
     
    669670        assertEquals(1111, merged.getUser().getId());
    670671        assertEquals(theirWay.getTimestamp(), merged.getTimestamp());
    671         assertTrue(merged == myWay);
    672         assertTrue(merged.getNode(0) == n1);
    673         assertTrue(merged.getNode(1) == n2);
    674 
    675         assertTrue(!merged.isModified());
     672        assertSame(merged, myWay);
     673        assertSame(merged.getNode(0), n1);
     674        assertSame(merged.getNode(1), n2);
     675
     676        assertFalse(merged.isModified());
    676677    }
    677678
     
    723724        assertEquals(1111, merged.getUser().getId());
    724725        assertEquals(theirWay.getTimestamp(), merged.getTimestamp());
    725         assertTrue(merged == myWay);
    726         assertTrue(merged.getNode(0) == n1);
    727         assertTrue(merged.getNode(1) == n2);
    728 
    729         assertTrue(!merged.isModified());
     726        assertSame(merged, myWay);
     727        assertSame(merged.getNode(0), n1);
     728        assertSame(merged.getNode(1), n2);
     729
     730        assertFalse(merged.isModified());
    730731    }
    731732
     
    830831
    831832        Node n = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE);
    832         assertTrue(n != null);
     833        assertNotNull(n);
    833834
    834835        assertEquals(1, visitor.getConflicts().size());
     
    926927        OsmPrimitive p= my.getPrimitiveById(1, OsmPrimitiveType.NODE);
    927928        assertNotNull(p);
    928         assertTrue(!p.isIncomplete());
     929        assertFalse(p.isIncomplete());
    929930        p= my.getPrimitiveById(2, OsmPrimitiveType.NODE);
    930931        assertNotNull(p);
    931         assertTrue(!p.isIncomplete());
     932        assertFalse(p.isIncomplete());
    932933        p= my.getPrimitiveById(3,OsmPrimitiveType.WAY);
    933934        assertNotNull(p);
    934         assertTrue(!p.isIncomplete());
     935        assertFalse(p.isIncomplete());
    935936
    936937        Way w = (Way)my.getPrimitiveById(3,OsmPrimitiveType.WAY);
    937938        assertNotNull(w);
    938         assertTrue(!p.isIncomplete());
     939        assertFalse(p.isIncomplete());
    939940        assertEquals(2, w.getNodesCount());
    940         assertTrue(!w.getNode(0).isIncomplete());
    941         assertTrue(!w.getNode(1).isIncomplete());
     941        assertFalse(w.getNode(0).isIncomplete());
     942        assertFalse(w.getNode(1).isIncomplete());
    942943    }
    943944
  • trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java

    r7081 r8450  
    22package org.openstreetmap.josm.data.osm;
    33
     4import static org.junit.Assert.assertFalse;
    45import static org.junit.Assert.assertTrue;
    56
     
    5859
    5960        assertTrue(n2.isDisabledAndHidden());
    60         assertTrue(!n1.isDisabled());
     61        assertFalse(n1.isDisabled());
    6162    }
    6263
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java

    r7937 r8450  
    22package org.openstreetmap.josm.data.osm;
    33
     4import static org.junit.Assert.assertFalse;
     5import static org.junit.Assert.assertNull;
     6import static org.junit.Assert.assertSame;
    47import static org.junit.Assert.assertTrue;
    58
     
    2730    public void emptyNode() {
    2831        Node n = new Node();
    29         assertTrue(n.getKeys().size() == 0);
    30         assertTrue(!n.hasKeys());
    31         assertTrue(!n.hasKey("nosuchkey"));
     32        assertSame(n.getKeys().size(), 0);
     33        assertFalse(n.hasKeys());
     34        assertFalse(n.hasKey("nosuchkey"));
    3235        assertTrue(n.keySet().isEmpty());
    3336
     
    4346        n.put("akey", "avalue");
    4447        assertTrue(n.get("akey").equals("avalue"));
    45         assertTrue(n.getKeys().size() == 1);
     48        assertSame(n.getKeys().size(), 1);
    4649
    47         assertTrue(n.keySet().size() == 1);
     50        assertSame(n.keySet().size(), 1);
    4851        assertTrue(n.keySet().contains("akey"));
    4952    }
     
    5962        assertTrue(n.get("key.1").equals("value.1"));
    6063        assertTrue(n.get("key.2").equals("value.2"));
    61         assertTrue(n.getKeys().size() == 2);
     64        assertSame(n.getKeys().size(), 2);
    6265        assertTrue(n.hasKeys());
    6366        assertTrue(n.hasKey("key.1"));
    6467        assertTrue(n.hasKey("key.2"));
    65         assertTrue(!n.hasKey("nosuchkey"));
     68        assertFalse(n.hasKey("nosuchkey"));
    6669    }
    6770
     
    7578        n.put("key.2", "value.2");
    7679
    77         n.remove("nosuchkey");               // should work
    78         assertTrue(n.getKeys().size() == 2); // still 2 tags ?
     80        n.remove("nosuchkey");             // should work
     81        assertSame(n.getKeys().size(), 2); // still 2 tags ?
    7982
    8083        n.remove("key.1");
    81         assertTrue(n.getKeys().size() == 1);
    82         assertTrue(!n.hasKey("key.1"));
    83         assertTrue(n.get("key.1") == null);
     84        assertSame(n.getKeys().size(), 1);
     85        assertFalse(n.hasKey("key.1"));
     86        assertNull(n.get("key.1"));
    8487        assertTrue(n.hasKey("key.2"));
    8588        assertTrue(n.get("key.2").equals("value.2"));
    8689
    8790        n.remove("key.2");
    88         assertTrue(n.getKeys().size() == 0);
    89         assertTrue(!n.hasKey("key.1"));
    90         assertTrue(n.get("key.1") == null);
    91         assertTrue(!n.hasKey("key.2"));
    92         assertTrue(n.get("key.2") == null);
     91        assertSame(n.getKeys().size(), 0);
     92        assertFalse(n.hasKey("key.1"));
     93        assertNull(n.get("key.1"));
     94        assertFalse(n.hasKey("key.2"));
     95        assertNull(n.get("key.2"));
    9396    }
    9497
     
    104107
    105108        n.removeAll();
    106         assertTrue(n.getKeys().size() == 0);
     109        assertSame(n.getKeys().size(), 0);
    107110    }
    108111
     
    141144        n2.put("key.2", "value.4");
    142145
    143         assertTrue(!n1.hasEqualSemanticAttributes(n2));
     146        assertFalse(n1.hasEqualSemanticAttributes(n2));
    144147    }
    145148}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java

    r7937 r8450  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
    56
    67import java.util.Date;
     
    2829        assertEquals(1, node.getId());
    2930        assertEquals(2, node.getVersion());
    30         assertEquals(true, node.isVisible());
     31        assertTrue(node.isVisible());
    3132        assertEquals("testuser", node.getUser().getName());
    3233        assertEquals(3, node.getUser().getId());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java

    r7937 r8450  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertTrue;
    56import static org.junit.Assert.fail;
    67
     
    2829        assertEquals(1, way.getId());
    2930        assertEquals(2, way.getVersion());
    30         assertEquals(true, way.isVisible());
     31        assertTrue(way.isVisible());
    3132        assertEquals("testuser", way.getUser().getName());
    3233        assertEquals(3, way.getUser().getId());
  • trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java

    r7151 r8450  
    22package org.openstreetmap.josm.data.projection;
    33
     4import static org.junit.Assert.assertSame;
    45import static org.junit.Assert.assertTrue;
    56
     
    6061            }
    6162        }
    62         assertTrue(errs.toString(), errs.length() == 0);
     63        assertSame(errs.toString(), errs.length(), 0);
    6364    }
    6465
  • trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java

    r7937 r8450  
    33
    44import static org.hamcrest.CoreMatchers.is;
     5import static org.junit.Assert.assertSame;
    56import static org.junit.Assert.assertThat;
    6 import static org.junit.Assert.assertTrue;
    77
    88import java.io.FileInputStream;
     
    6767            System.out.println("p3: "+DefaultNameFormatter.getInstance().format(p3)+" - "+p3); // route(lcn Sal  Salier-Radweg(412 members)
    6868
    69             assertTrue(comparator.compare(p1, p2) == -1); // p1 < p2
    70             assertTrue(comparator.compare(p2, p1) ==  1); // p2 > p1
     69            assertSame(comparator.compare(p1, p2), -1); // p1 < p2
     70            assertSame(comparator.compare(p2, p1),  1); // p2 > p1
    7171
    72             assertTrue(comparator.compare(p1, p3) == -1); // p1 < p3
    73             assertTrue(comparator.compare(p3, p1) ==  1); // p3 > p1
    74             assertTrue(comparator.compare(p2, p3) ==  1); // p2 > p3
    75             assertTrue(comparator.compare(p3, p2) == -1); // p3 < p2
     72            assertSame(comparator.compare(p1, p3), -1); // p1 < p3
     73            assertSame(comparator.compare(p3, p1),  1); // p3 > p1
     74            assertSame(comparator.compare(p2, p3),  1); // p2 > p3
     75            assertSame(comparator.compare(p3, p2), -1); // p3 < p2
    7676
    7777            Relation[] relations = new ArrayList<>(ds.getRelations()).toArray(new Relation[0]);
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java

    r8391 r8450  
    55import static org.fest.reflect.core.Reflection.method;
    66import static org.junit.Assert.assertEquals;
     7import static org.junit.Assert.assertFalse;
    78import static org.junit.Assert.assertTrue;
    89import static org.junit.Assert.fail;
     
    697698
    698699        model.setFrozen(false);
    699         assertTrue(!model.isFrozen());
     700        assertFalse(model.isFrozen());
    700701    }
    701702
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/PresetClassificationsTest.java

    r7937 r8450  
    22package org.openstreetmap.josm.gui.tagging;
    33
     4import static org.junit.Assert.assertFalse;
    45import static org.junit.Assert.assertTrue;
    56
     
    5455        w.addNode(new Node());
    5556        w.addNode(new Node());
    56         assertTrue("unclosed way should not match building preset", !getMatchingPresetNames("building", w).contains("Building"));
     57        assertFalse("unclosed way should not match building preset", getMatchingPresetNames("building", w).contains("Building"));
    5758        w.addNode(n1);
    5859        assertTrue("closed way should match building preset", getMatchingPresetNames("building", w).contains("Building"));
     
    6465        assertTrue("railway=tram should match 'Railway Route' for relation creation", getMatchingPresetNames("route", tram).contains("Railway Route"));
    6566        assertTrue("railway=tram should match 'Public Transport Route' for relation creation", getMatchingPresetNames("route", tram).contains("Public Transport Route"));
    66         assertTrue("railway=tram should not match 'Bus route'", !getMatchingPresetNames("route", tram).contains("Bus route"));
     67        assertFalse("railway=tram should not match 'Bus route'", getMatchingPresetNames("route", tram).contains("Bus route"));
    6768    }
    6869}
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r7937 r8450  
    33
    44import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertNotNull;
     6import static org.junit.Assert.assertSame;
    57import static org.junit.Assert.assertTrue;
    68
     
    6466        for (String file : new String[]{"osm.jos", "osm.joz"}) {
    6567            List<Layer> layers = testRead(file);
    66             assertTrue(layers.size() == 1);
     68            assertSame(layers.size(), 1);
    6769            assertTrue(layers.get(0) instanceof OsmDataLayer);
    6870            OsmDataLayer osm = (OsmDataLayer) layers.get(0);
     
    8082        for (String file : new String[]{"gpx.jos", "gpx.joz", "nmea.jos"}) {
    8183            List<Layer> layers = testRead(file);
    82             assertTrue(layers.size() == 1);
     84            assertSame(layers.size(), 1);
    8385            assertTrue(layers.get(0) instanceof GpxLayer);
    8486            GpxLayer gpx = (GpxLayer) layers.get(0);
     
    9597    public void testReadGpxAndMarker() throws IOException, IllegalDataException {
    9698        List<Layer> layers = testRead("gpx_markers.joz");
    97         assertTrue(layers.size() == 2);
     99        assertSame(layers.size(), 2);
    98100        GpxLayer gpx = null;
    99101        MarkerLayer marker = null;
     
    105107            }
    106108        }
    107         assertTrue(gpx != null);
    108         assertTrue(marker != null);
     109        assertNotNull(gpx);
     110        assertNotNull(marker);
    109111        assertEquals(gpx.getName(), "GPX layer name");
    110112        assertEquals(marker.getName(), "Marker layer name");
Note: See TracChangeset for help on using the changeset viewer.