Ignore:
Timestamp:
2010-10-12T16:31:47+02:00 (14 years ago)
Author:
guggis
Message:

Fixing #4855 - turnrestrictions plugin: some issues
Reorganized test cases

Location:
applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions/AllUnitTests.java

    r23510 r23571  
    11package org.openstreetmap.josm.plugins.turnrestrictions;
    22
     3import org.junit.runner.RunWith;
     4import org.junit.runners.Suite;
    35import org.openstreetmap.josm.plugins.turnrestrictions.editor.AllEditorTests;
    46
    5 import junit.framework.Test;
    6 import junit.framework.TestSuite;
    7 
    8 public class AllUnitTests {
    9         public static Test suite() throws Exception {
    10                 TestSuite suite = new TestSuite(AllUnitTests.class.getName());
    11                 suite.addTest(AllEditorTests.suite());
    12                 return suite;
    13         }
    14 }
     7@RunWith(Suite.class)
     8@Suite.SuiteClasses({
     9        AllEditorTests.class,
     10        TurnRestrictionBuilderTest.class
     11})
     12public class AllUnitTests {}
  • applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AllEditorTests.java

    r23510 r23571  
    11package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    22
    3 import groovy.util.GroovyTestSuite;
    4 import junit.framework.Test;
    53import junit.framework.TestCase;
    6 import junit.framework.TestSuite;
    74
    8 public class AllEditorTests extends TestCase{
     5import org.junit.runner.RunWith;
     6import org.junit.runners.Suite;
    97
    10         private static final String TEST_ROOT = "test/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/";
    11         private static final GroovyTestSuite gsuite = new GroovyTestSuite();
    12        
    13         private static <T extends TestCase> Class<T> groovyts(String className) throws Exception {
    14                 return gsuite.compile(TEST_ROOT + className + ".groovy");
    15         }
    16        
    17         public static Test suite() throws Exception {
    18                 TestSuite suite = new TestSuite(AllEditorTests.class.getName());
    19                 suite.addTestSuite(groovyts("JosmSelectionListModelTest"));
    20                 suite.addTestSuite(groovyts("TurnRestrictionEditorModelUnitTest"));
    21                 suite.addTestSuite(groovyts("TurnRestrictionLegEditorUnitTest"));
    22                 suite.addTestSuite(groovyts("TurnRestrictionTypeRendererTest"));
    23                 suite.addTestSuite(groovyts("TurnRestrictionTypeTest"));
    24                 return suite;
    25         }
    26 }
     8@RunWith(Suite.class)
     9@Suite.SuiteClasses({
     10        JosmSelectionListModelTest.class,
     11        TurnRestrictionEditorModelUnitTest.class,
     12        TurnRestrictionLegEditorUnitTest.class,
     13        TurnRestrictionTypeRendererTest.class,
     14        TurnRestrictionTypeTest.class,
     15        ExceptValueModelTest.class
     16})
     17public class AllEditorTests extends TestCase{}
  • applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.groovy

    r23510 r23571  
    3333                DataSet ds = new DataSet()
    3434                OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
    35                 JosmSelectionListModel model = new JosmSelectionListModel(layer, new DefaultListSelectionModel());             
     35                JosmSelectionListModel model = new JosmSelectionListModel(layer);               
    3636               
    3737                shouldFail(IllegalArgumentException){
    38                         model = new JosmSelectionListModel(layer, null)
    39                 }
    40                
    41                 shouldFail(IllegalArgumentException){
    42                         model = new JosmSelectionListModel(null, new DefaultListSelectionModel())
     38                        model = new JosmSelectionListModel(null)
    4339                }
    4440        }
     
    4844                DataSet ds = new DataSet()
    4945                OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
    50                 JosmSelectionListModel model = new JosmSelectionListModel(layer, new DefaultListSelectionModel());
     46                JosmSelectionListModel model = new JosmSelectionListModel(layer);
    5147               
    5248                // set a selection with three objects
     
    7066                DataSet ds = new DataSet()
    7167                OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
    72                 JosmSelectionListModel model = new JosmSelectionListModel(layer, new DefaultListSelectionModel());
     68                JosmSelectionListModel model = new JosmSelectionListModel(layer);
    7369                def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]   
    7470                model.setJOSMSelection(objects)
     
    8884                DataSet ds = new DataSet()
    8985                OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
    90                 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    9186               
    92                 JosmSelectionListModel model = new JosmSelectionListModel(layer, selectionModel);
     87                JosmSelectionListModel model = new JosmSelectionListModel(layer);
     88                DefaultListSelectionModel selectionModel = model.getListSelectionModel()
     89               
    9390                assert model.getSelected() != null
    9491                assert model.getSelected().isEmpty()
     
    109106                DataSet ds = new DataSet()
    110107                OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
    111                 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    112108               
    113109                // set selected with null is OK - nothing selected thereafter
    114                 JosmSelectionListModel model = new JosmSelectionListModel(layer, selectionModel);
     110                JosmSelectionListModel model = new JosmSelectionListModel(layer);
     111                DefaultListSelectionModel selectionModel = model.getListSelectionModel()
    115112                model.setSelected(null)
    116113                assert model.getSelected().isEmpty()
     
    135132        public void test_editLayerChanged() {
    136133                DataSet ds = new DataSet()
    137                 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();            
     134                       
    138135                def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]   
    139136                objects.each {ds.addPrimitive(it)}
     
    142139                OsmDataLayer layer2 = new OsmDataLayer(new DataSet(),"layer2", null)
    143140               
    144                 JosmSelectionListModel model = new JosmSelectionListModel(layer1, selectionModel);
    145                
     141                JosmSelectionListModel model = new JosmSelectionListModel(layer1);
     142                DefaultListSelectionModel selectionModel = model.getListSelectionModel()
    146143                // switch from edit layer1 to edit layer2. content of the JOSM selection
    147144                // should be empty thereafter
Note: See TracChangeset for help on using the changeset viewer.