Changeset 14385 in josm for trunk/test/unit
- Timestamp:
- 2018-10-30T00:47:23+01:00 (5 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java
r14138 r14385 2 2 package org.openstreetmap.josm.gui.dialogs.relation; 3 3 4 import static org.junit.Assert.assertEquals; 4 5 import static org.junit.Assert.assertNotNull; 5 6 import static org.junit.Assert.assertNull; … … 7 8 import java.util.Collections; 8 9 10 import javax.swing.JOptionPane; 9 11 import javax.swing.JPanel; 10 12 … … 21 23 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 22 24 import org.openstreetmap.josm.testutils.JOSMTestRules; 25 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; 23 26 24 27 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 83 86 @Test 84 87 public void testAddPrimitivesToRelation() { 88 TestUtils.assumeWorkingJMockit(); 89 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(); 90 85 91 Relation r = TestUtils.addFakeDataSet(new Relation(1)); 86 92 assertNull(GenericRelationEditor.addPrimitivesToRelation(r, Collections.<OsmPrimitive>emptyList())); 93 94 jopsMocker.getMockResultMap().put( 95 "<html>You are trying to add a relation to itself.<br><br>This creates circular references " 96 + "and is therefore discouraged.<br>Skipping relation 'incomplete'.</html>", 97 JOptionPane.OK_OPTION 98 ); 99 87 100 assertNull(GenericRelationEditor.addPrimitivesToRelation(r, Collections.singleton(new Relation(1)))); 101 102 assertEquals(1, jopsMocker.getInvocationLog().size()); 103 Object[] invocationLogEntry = jopsMocker.getInvocationLog().get(0); 104 assertEquals(JOptionPane.OK_OPTION, (int) invocationLogEntry[0]); 105 assertEquals("Warning", invocationLogEntry[2]); 88 106 89 107 assertNotNull(GenericRelationEditor.addPrimitivesToRelation(r, Collections.singleton(new Node(1)))); 90 108 assertNotNull(GenericRelationEditor.addPrimitivesToRelation(r, Collections.singleton(new Way(1)))); 91 109 assertNotNull(GenericRelationEditor.addPrimitivesToRelation(r, Collections.singleton(new Relation(2)))); 110 111 assertEquals(1, jopsMocker.getInvocationLog().size()); 92 112 } 93 113 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java
r14380 r14385 11 11 import javax.swing.text.JTextComponent; 12 12 13 import org.openstreetmap.josm.TestUtils; 14 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 13 15 import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker; 14 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;15 16 16 17 import com.google.common.collect.ImmutableMap; … … 71 72 @Test 72 73 public void testDeleteCurrentRelationAction() { 74 TestUtils.assumeWorkingJMockit(); 73 75 final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker( 74 76 ImmutableMap.<String, Object>of( … … 107 109 @Test 108 110 public void testSetRoleAction() { 111 TestUtils.assumeWorkingJMockit(); 109 112 final JOptionPaneSimpleMocker.MessagePanelMocker mpMocker = new JOptionPaneSimpleMocker.MessagePanelMocker(); 110 113 // JOptionPaneSimpleMocker doesn't handle showOptionDialog calls because of their potential
Note:
See TracChangeset
for help on using the changeset viewer.