- Timestamp:
- 2010-10-01T19:26:20+02:00 (14 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/APIDataSetTest.java
r3025 r3577 7 7 import java.util.List; 8 8 9 import org.junit.BeforeClass; 9 10 import org.junit.Test; 11 import org.openstreetmap.josm.Main; 10 12 import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException; 11 13 import org.openstreetmap.josm.data.APIDataSet; 14 import org.openstreetmap.josm.data.Preferences; 12 15 13 16 14 17 public class APIDataSetTest { 15 18 19 @BeforeClass 20 public static void init() { 21 Main.pref = new Preferences(); 22 } 16 23 17 24 @Test -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r3459 r3577 15 15 import org.junit.After; 16 16 import org.junit.Before; 17 import org.junit.BeforeClass; 17 18 import org.junit.Test; 18 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.data.Preferences; 19 21 import org.openstreetmap.josm.data.coor.LatLon; 20 22 import org.openstreetmap.josm.data.projection.Mercator; … … 59 61 }*/ 60 62 63 @BeforeClass 64 public static void init() { 65 Main.pref = new Preferences(); 66 } 67 61 68 private DataSet my; 62 69 private DataSet their; -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r3459 r3577 17 17 import org.openstreetmap.josm.actions.search.SearchAction.SearchMode; 18 18 import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError; 19 import org.openstreetmap.josm.data.Preferences; 19 20 import org.openstreetmap.josm.data.coor.LatLon; 20 21 import org.openstreetmap.josm.data.projection.Mercator; … … 25 26 26 27 public class FilterTest { 28 27 29 @BeforeClass 28 30 public static void setUp() { 29 31 Main.proj = new Mercator(); 32 Main.pref = new Preferences(); 30 33 } 31 34 -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandling.java
r2917 r3577 4 4 import static org.junit.Assert.assertTrue; 5 5 6 import org.junit.BeforeClass; 6 7 import org.junit.Test; 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.data.Preferences; 7 10 import org.openstreetmap.josm.data.coor.LatLon; 8 11 … … 10 13 * Some unit test cases for basic tag management on {@see OsmPrimitive}. Uses 11 14 * {@see Node} for the tests, {@see OsmPrimitive} is abstract. 12 * 15 * 13 16 */ 14 17 public class OsmPrimitiveKeyHandling { 18 19 @BeforeClass 20 public static void init() { 21 Main.pref = new Preferences(); 22 } 15 23 16 24 /** … … 30 38 /** 31 39 * Add a tag to an empty node and test the query and get methods. 32 * 40 * 33 41 */ 34 42 @Test … … 62 70 /** 63 71 * Remove tags from a node with two tags and test the state of the node. 64 * 72 * 65 73 */ 66 74 @Test … … 90 98 /** 91 99 * Remove all tags from a node 92 * 100 * 93 101 */ 94 102 @Test -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r3459 r3577 9 9 import org.junit.Test; 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.Preferences; 11 12 import org.openstreetmap.josm.data.coor.LatLon; 12 13 import org.openstreetmap.josm.data.projection.Mercator; 13 14 14 15 public class OsmPrimitiveTest { 16 17 @BeforeClass 18 public static void init() { 19 Main.pref = new Preferences(); 20 } 15 21 16 22 private void compareReferrers(OsmPrimitive actual, OsmPrimitive... expected) { -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r3476 r3577 11 11 import org.fest.reflect.reference.TypeRef; 12 12 import org.junit.Assert; 13 import org.junit.BeforeClass; 13 14 import org.junit.Test; 14 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.data.Preferences; 15 17 import org.openstreetmap.josm.data.coor.LatLon; 16 18 import org.openstreetmap.josm.data.projection.Mercator; … … 19 21 20 22 public class QuadBucketsTest { 23 24 @BeforeClass 25 public static void init() { 26 Main.pref = new Preferences(); 27 } 21 28 22 29 private void removeAllTest(DataSet ds) { -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r3283 r3577 8 8 import org.junit.Test; 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.data.Preferences; 10 11 import org.openstreetmap.josm.data.coor.LatLon; 11 12 import org.openstreetmap.josm.data.projection.Mercator; … … 16 17 public static void setUp() { 17 18 Main.proj = new Mercator(); 19 Main.pref = new Preferences(); 18 20 } 19 21 -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r3284 r3577 12 12 import org.junit.Test; 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.data.Preferences; 14 15 import org.openstreetmap.josm.data.coor.LatLon; 15 16 import org.openstreetmap.josm.data.osm.DataSet; … … 37 38 public static void setUp() { 38 39 Main.proj = new Mercator(); 40 Main.pref = new Preferences(); 39 41 } 40 42 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/nodes/NodeListMergeModelTest.java
r3025 r3577 16 16 import javax.swing.DefaultListSelectionModel; 17 17 18 import org.junit.BeforeClass; 18 19 import org.junit.Test; 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.data.Preferences; 19 22 import org.openstreetmap.josm.data.osm.DatasetFactory; 20 23 import org.openstreetmap.josm.data.osm.Node; … … 26 29 private DatasetFactory my = new DatasetFactory(); 27 30 private DatasetFactory their = new DatasetFactory(); 31 32 @BeforeClass 33 public static void init() { 34 Main.pref = new Preferences(); 35 } 28 36 29 37 @SuppressWarnings("unchecked") -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java
r3034 r3577 10 10 11 11 import org.junit.Before; 12 import org.junit.BeforeClass; 12 13 import org.junit.Test; 13 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.data.Preferences; 14 16 import org.openstreetmap.josm.data.conflict.Conflict; 15 17 import org.openstreetmap.josm.data.coor.LatLon; … … 43 45 PropertiesMergeModel model; 44 46 47 @BeforeClass 48 public static void init() { 49 Main.proj = new Epsg4326(); 50 Main.pref = new Preferences(); 51 } 52 45 53 @Before 46 54 public void setUp() { 47 55 model = new PropertiesMergeModel(); 48 Main.proj = new Epsg4326();49 56 } 50 57 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeItemTest.java
r1954 r3577 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import org.junit.*; 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 6 import static org.junit.Assert.fail; 7 8 import org.junit.BeforeClass; 9 import org.junit.Test; 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.data.Preferences; 5 12 import org.openstreetmap.josm.data.osm.Node; 6 13 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; 7 14 import org.openstreetmap.josm.gui.conflict.pair.tags.TagMergeItem; 8 15 9 import static org.junit.Assert.*;10 11 16 public class TagMergeItemTest { 12 17 13 @Test 14 public void test_TagMergeItem() { 15 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 16 assertEquals("key", item.getKey()); 17 assertEquals("myvalue", item.getMyTagValue()); 18 assertEquals("theirvalue", item.getTheirTagValue()); 19 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 20 } 21 22 @Test 23 public void test_TagMergeItem_2() { 24 Node n1 = new Node(1); 25 Node n2 = new Node(1); 26 n1.put("key", "myvalue"); 27 n2.put("key", "theirvalue"); 28 29 TagMergeItem item = new TagMergeItem("key", n1, n2); 30 assertEquals("key", item.getKey()); 31 assertEquals("myvalue", item.getMyTagValue()); 32 assertEquals("theirvalue", item.getTheirTagValue()); 33 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 34 } 35 36 @Test 37 public void test_TagMergeItem_3() { 38 Node n1 = new Node(1); 39 Node n2 = new Node(1); 40 n1.put("key", "myvalue"); 41 // n2 does not have this key 42 43 TagMergeItem item = new TagMergeItem("key", n1, n2); 44 assertEquals("key", item.getKey()); 45 assertEquals("myvalue", item.getMyTagValue()); 46 assertNull(item.getTheirTagValue()); 47 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 48 } 49 50 @Test 51 public void test_TagMergeItem_4() { 52 Node n1 = new Node(1); 53 Node n2 = new Node(1); 54 // n1 does not have this key 55 // n1.put("key", "myvalue"); 56 n2.put("key", "theirvalue"); 57 58 TagMergeItem item = new TagMergeItem("key", n1, n2); 59 assertEquals("key", item.getKey()); 60 assertNull(item.getMyTagValue()); 61 assertEquals("theirvalue",item.getTheirTagValue()); 62 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 63 } 64 65 66 @Test 67 public void test_decide() { 68 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 69 item.decide(MergeDecisionType.KEEP_MINE); 70 assertEquals(MergeDecisionType.KEEP_MINE, item.getMergeDecision()); 71 } 72 73 @Test() 74 public void test_decide_1() { 75 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 76 try { 77 item.decide(null); 78 fail("expected IllegalArgumentException not thrown"); 79 } catch(IllegalArgumentException e) { 80 // OK 81 } 82 } 83 84 @Test() 85 public void test_applyToMyPrimitive() { 86 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 87 item.decide(MergeDecisionType.KEEP_MINE); 88 89 Node n1 = new Node(1); 90 n1.put("key", "oldvalue"); 91 item.applyToMyPrimitive(n1); 92 assertEquals("myvalue", n1.get("key")); 18 @BeforeClass 19 public static void init() { 20 Main.pref = new Preferences(); 21 } 93 22 94 n1 = new Node(1); 95 item.applyToMyPrimitive(n1); 96 assertEquals("myvalue", n1.get("key")); 23 @Test 24 public void test_TagMergeItem() { 25 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 26 assertEquals("key", item.getKey()); 27 assertEquals("myvalue", item.getMyTagValue()); 28 assertEquals("theirvalue", item.getTheirTagValue()); 29 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 30 } 97 31 98 } 99 100 @Test() 101 public void test_applyToMyPrimitive_2() { 102 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 103 item.decide(MergeDecisionType.KEEP_THEIR); 104 105 Node n1 = new Node(1); 106 n1.put("key", "oldvalue"); 107 item.applyToMyPrimitive(n1); 108 assertEquals("theirvalue", n1.get("key")); 32 @Test 33 public void test_TagMergeItem_2() { 34 Node n1 = new Node(1); 35 Node n2 = new Node(1); 36 n1.put("key", "myvalue"); 37 n2.put("key", "theirvalue"); 109 38 110 n1 = new Node(1); 111 item.applyToMyPrimitive(n1); 112 assertEquals("theirvalue", n1.get("key")); 113 } 114 115 @Test() 116 public void test_applyToMyPrimitive_3() { 117 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 118 // item is undecided 119 // item.decide(MergeDecisionType.KEEP_THEIR); 120 121 Node n1 = new Node(1); 122 n1.put("key", "oldvalue"); 123 try { 124 item.applyToMyPrimitive(n1); 125 fail("expected IllegalStateException"); 126 } catch(IllegalStateException e) { 127 // OK 128 } 129 } 130 131 @Test() 132 public void test_applyToMyPrimitive_4() { 133 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 134 135 try { 136 item.applyToMyPrimitive(null); 137 fail("expected IllegalArgumentException"); 138 } catch(IllegalArgumentException e) { 139 // OK 140 } 141 } 39 TagMergeItem item = new TagMergeItem("key", n1, n2); 40 assertEquals("key", item.getKey()); 41 assertEquals("myvalue", item.getMyTagValue()); 42 assertEquals("theirvalue", item.getTheirTagValue()); 43 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 44 } 45 46 @Test 47 public void test_TagMergeItem_3() { 48 Node n1 = new Node(1); 49 Node n2 = new Node(1); 50 n1.put("key", "myvalue"); 51 // n2 does not have this key 52 53 TagMergeItem item = new TagMergeItem("key", n1, n2); 54 assertEquals("key", item.getKey()); 55 assertEquals("myvalue", item.getMyTagValue()); 56 assertNull(item.getTheirTagValue()); 57 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 58 } 59 60 @Test 61 public void test_TagMergeItem_4() { 62 Node n1 = new Node(1); 63 Node n2 = new Node(1); 64 // n1 does not have this key 65 // n1.put("key", "myvalue"); 66 n2.put("key", "theirvalue"); 67 68 TagMergeItem item = new TagMergeItem("key", n1, n2); 69 assertEquals("key", item.getKey()); 70 assertNull(item.getMyTagValue()); 71 assertEquals("theirvalue",item.getTheirTagValue()); 72 assertEquals(MergeDecisionType.UNDECIDED, item.getMergeDecision()); 73 } 74 75 76 @Test 77 public void test_decide() { 78 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 79 item.decide(MergeDecisionType.KEEP_MINE); 80 assertEquals(MergeDecisionType.KEEP_MINE, item.getMergeDecision()); 81 } 82 83 @Test() 84 public void test_decide_1() { 85 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 86 try { 87 item.decide(null); 88 fail("expected IllegalArgumentException not thrown"); 89 } catch(IllegalArgumentException e) { 90 // OK 91 } 92 } 93 94 @Test() 95 public void test_applyToMyPrimitive() { 96 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 97 item.decide(MergeDecisionType.KEEP_MINE); 98 99 Node n1 = new Node(1); 100 n1.put("key", "oldvalue"); 101 item.applyToMyPrimitive(n1); 102 assertEquals("myvalue", n1.get("key")); 103 104 n1 = new Node(1); 105 item.applyToMyPrimitive(n1); 106 assertEquals("myvalue", n1.get("key")); 107 108 } 109 110 @Test() 111 public void test_applyToMyPrimitive_2() { 112 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 113 item.decide(MergeDecisionType.KEEP_THEIR); 114 115 Node n1 = new Node(1); 116 n1.put("key", "oldvalue"); 117 item.applyToMyPrimitive(n1); 118 assertEquals("theirvalue", n1.get("key")); 119 120 n1 = new Node(1); 121 item.applyToMyPrimitive(n1); 122 assertEquals("theirvalue", n1.get("key")); 123 } 124 125 @Test() 126 public void test_applyToMyPrimitive_3() { 127 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 128 // item is undecided 129 // item.decide(MergeDecisionType.KEEP_THEIR); 130 131 Node n1 = new Node(1); 132 n1.put("key", "oldvalue"); 133 try { 134 item.applyToMyPrimitive(n1); 135 fail("expected IllegalStateException"); 136 } catch(IllegalStateException e) { 137 // OK 138 } 139 } 140 141 @Test() 142 public void test_applyToMyPrimitive_4() { 143 TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue"); 144 145 try { 146 item.applyToMyPrimitive(null); 147 fail("expected IllegalArgumentException"); 148 } catch(IllegalArgumentException e) { 149 // OK 150 } 151 } 142 152 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagMergeModelTest.java
r3095 r3577 10 10 import java.util.List; 11 11 12 import org.junit.BeforeClass; 12 13 import org.junit.Test; 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.data.Preferences; 13 16 import org.openstreetmap.josm.data.osm.Node; 14 17 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; … … 18 21 @SuppressWarnings("unchecked") 19 22 public class TagMergeModelTest { 23 24 @BeforeClass 25 public static void init() { 26 Main.pref = new Preferences(); 27 } 20 28 21 29 @Test
Note:
See TracChangeset
for help on using the changeset viewer.