Ignore:
Timestamp:
2016-07-02T01:10:44+02:00 (9 years ago)
Author:
donvip
Message:

checkstyle

Location:
applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions
Files:
9 edited

Legend:

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

    r30365 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions;
    23
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/AllEditorTests.java

    r30365 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    2 
    3 import junit.framework.TestCase;
    43
    54import org.junit.runner.RunWith;
    65import org.junit.runners.Suite;
     6
     7import junit.framework.TestCase;
    78
    89@RunWith(Suite.class)
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanelTest.java

    r30557 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    23
     
    1112
    1213/**
    13  * Simple functional test for the layout / basic functionality of {@see BasicEditorPanel} 
    14  *   
     14 * Simple functional test for the layout / basic functionality of {@see BasicEditorPanel}
     15 *
    1516 */
    1617@Ignore("no test")
     
    1920    private TurnRestrictionEditorModel model;
    2021    private DataSet ds;
    21    
     22
    2223    public BasicEditorPanelTest() {
    2324        ds = new DataSet();
    24         OsmDataLayer layer =new OsmDataLayer(ds, "test",null);
    25         // mock a controler 
     25        OsmDataLayer layer = new OsmDataLayer(ds, "test", null);
     26        // mock a controler
    2627        NavigationControler controler = new NavigationControler() {
     28            @Override
    2729            public void gotoAdvancedEditor() {
    2830            }
    2931
     32            @Override
    3033            public void gotoBasicEditor() {
    3134            }
    3235
     36            @Override
    3337            public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
    34             }           
     38            }
    3539        };
    3640        model = new TurnRestrictionEditorModel(layer, controler);
    37        
     41
    3842        BasicEditorPanel panel = new BasicEditorPanel(model);
    39        
     43
    4044        Container c = getContentPane();
    4145        c.setLayout(new BorderLayout());
    42         c.add(panel, BorderLayout.CENTER);     
    43         setSize(600,600);
     46        c.add(panel, BorderLayout.CENTER);
     47        setSize(600, 600);
    4448        setDefaultCloseOperation(EXIT_ON_CLOSE);
    4549    }
    46    
    47    
    48     static public void main(String args[]) {
     50
     51    public static void main(String[] args) {
    4952        new BasicEditorPanelTest().setVisible(true);
    5053    }
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java

    r30557 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    23
     
    1213
    1314/**
    14  * This is a simple test application to test the functionality/layout of 
     15 * This is a simple test application to test the functionality/layout of
    1516 * the {@see TurnRestrictionComboBox}
    16  * 
     17 *
    1718 */
    1819@Ignore("no test")
    1920public class TurnRestrictionComboBoxTest extends JFrame {
    20    
     21
    2122    private TurnRestrictionEditorModel model;
    2223    private DataSet ds = new DataSet();
    23    
     24
    2425    protected void build() {
    2526        ds = new DataSet();
    26         OsmDataLayer layer =new OsmDataLayer(ds, "test",null);
    27         // mock a controler 
     27        OsmDataLayer layer = new OsmDataLayer(ds, "test", null);
     28        // mock a controler
    2829        NavigationControler controler = new NavigationControler() {
     30            @Override
    2931            public void gotoAdvancedEditor() {
    3032            }
    3133
     34            @Override
    3235            public void gotoBasicEditor() {
    3336            }
    3437
     38            @Override
    3539            public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
    36             }           
     40            }
    3741        };
    3842        model = new TurnRestrictionEditorModel(layer, controler);
    39        
     43
    4044        Container c = getContentPane();
    4145        c.setLayout(new GridBagLayout());
     
    4448        gc.fill = GridBagConstraints.HORIZONTAL;
    4549        gc.weightx = 1.0;
    46        
     50
    4751        TurnRestrictionComboBox cb = new TurnRestrictionComboBox(
    4852                new TurnRestrictionComboBoxModel(model)
    4953        );
    50         add(cb, gc);       
     54        add(cb, gc);
    5155    }
    52    
     56
    5357    public TurnRestrictionComboBoxTest() {
    5458        build();
    55         setSize(600,600);
     59        setSize(600, 600);
    5660        setDefaultCloseOperation(EXIT_ON_CLOSE);
    5761    }
    58    
    59     public static void main(String args[]) {
     62
     63    public static void main(String[] args) {
    6064        new TurnRestrictionComboBoxTest().setVisible(true);
    6165    }
    62 
    6366}
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java

    r30557 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    23
     
    1213@Ignore("no test")
    1314public class TurnRestrictionEditorTest extends JFrame {
    14    
     15
    1516    public TurnRestrictionEditorTest() {
    16         setSize(10,10);
     17        setSize(10, 10);
    1718        TurnRestrictionEditor editor = new TurnRestrictionEditor(this, new OsmDataLayer(new DataSet(), "test", null));
    18         editor.setSize(600,600);
     19        editor.setSize(600, 600);
    1920        editor.setVisible(true);
    20        
     21
    2122        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    2223    }
    23    
    24     static public void main(String args[]) {
     24
     25    public static void main(String[] args) {
    2526        new TurnRestrictionEditorTest().setVisible(true);
    2627    }
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java

    r31944 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    23
     
    3031
    3132/**
    32  * Simple test application to test functionality and layout of the 
     33 * Simple test application to test functionality and layout of the
    3334 * {@see TurnRestrictionLegEditor}
    3435 */
    3536@Ignore("no test")
    3637public class TurnRestrictionLegEditorTest extends JFrame {
    37    
     38
    3839    private TurnRestrictionLegEditor editor;
    3940    private TurnRestrictionEditorModel model;
     
    4142    private DefaultListModel<OsmPrimitive> listModel;
    4243    private DataSet dataSet;
    43    
     44
    4445    protected JPanel buildLegEditorPanel() {
    4546        DataSet ds = new DataSet();
    46         OsmDataLayer layer =new OsmDataLayer(ds, "test",null);
    47         // mock a controler 
     47        OsmDataLayer layer = new OsmDataLayer(ds, "test", null);
     48        // mock a controler
    4849        NavigationControler controler = new NavigationControler() {
     50            @Override
    4951            public void gotoAdvancedEditor() {
    5052            }
    5153
     54            @Override
    5255            public void gotoBasicEditor() {
    5356            }
    5457
     58            @Override
    5559            public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
    56             }           
     60            }
    5761        };
    5862        JPanel pnl = new JPanel(new GridBagLayout());
     
    6064        gc.anchor = GridBagConstraints.NORTHWEST;
    6165        gc.fill = GridBagConstraints.HORIZONTAL;
    62         gc.weightx = 0.0;       
     66        gc.weightx = 0.0;
    6367        pnl.add(new JLabel("From"), gc);
    64        
     68
    6569        gc.weightx = 1.0;
    6670        gc.gridx = 1;
     
    6973        model.populate(new Relation());
    7074        pnl.add(editor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.FROM), gc);
    71        
     75
    7276        return pnl;
    7377    }
    74    
     78
    7579    protected JPanel buildObjectListPanel() {
    7680        JPanel pnl = new JPanel(new BorderLayout());
    7781        listModel = new DefaultListModel<>();
    7882        pnl.add(new JScrollPane(lstObjects = new JList<>(listModel)), BorderLayout.CENTER);
    79         lstObjects.setCellRenderer(new OsmPrimitivRenderer());     
    80        
    81         PrimitiveIdListProvider provider = new PrimitiveIdListProvider() {         
     83        lstObjects.setCellRenderer(new OsmPrimitivRenderer());
     84
     85        PrimitiveIdListProvider provider = new PrimitiveIdListProvider() {
     86            @Override
    8287            public List<PrimitiveId> getSelectedPrimitiveIds() {
    8388                List<PrimitiveId> ret = new ArrayList<>();
    84                 int [] sel = lstObjects.getSelectedIndices();
    85                 for (int i: sel){
     89                int[] sel = lstObjects.getSelectedIndices();
     90                for (int i: sel) {
    8691                    ret.add((lstObjects.getModel().getElementAt(i)).getPrimitiveId());
    8792                }
     
    8994            }
    9095        };
    91        
     96
    9297        lstObjects.setTransferHandler(new PrimitiveIdListTransferHandler(provider));
    9398        lstObjects.setDragEnabled(true);
    9499        return pnl;
    95100    }
    96    
     101
    97102    protected void build() {
    98103        Container c = getContentPane();
    99104        c.setLayout(new GridBagLayout());
    100        
     105
    101106        GridBagConstraints gc = new GridBagConstraints();
    102107        gc.anchor = GridBagConstraints.NORTHWEST;
    103         gc.fill = GridBagConstraints.HORIZONTAL;   
     108        gc.fill = GridBagConstraints.HORIZONTAL;
    104109        gc.insets = new Insets(20, 0, 20, 0);
    105         gc.weightx = 1.0;       
     110        gc.weightx = 1.0;
    106111        gc.weighty = 0.0;
    107112        add(buildLegEditorPanel(), gc);
    108        
     113
    109114        gc.gridy = 1;
    110115        gc.weightx = 1.0;
     
    112117        gc.fill = GridBagConstraints.BOTH;
    113118        add(buildObjectListPanel(), gc);
    114         setSize(600,600);   
     119        setSize(600, 600);
    115120    }
    116    
     121
    117122    protected void initForTest1() {
    118123        Way w = new Way(1);
    119124        w.put("name", "way-1");
    120        
     125
    121126        editor.getModel().setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, w);
    122127    }
    123    
     128
    124129    protected void initForTest2() {
    125130        Way w = new Way(1);
    126         w.put("name", "way-1");     
     131        w.put("name", "way-1");
    127132        dataSet.addPrimitive(w);
    128133        editor.getModel().setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, w);
    129        
    130         Node n = new Node(new LatLon(1,1));
     134
     135        Node n = new Node(new LatLon(1, 1));
    131136        n.setOsmId(1, 1);
    132137        n.put("name", "node.1");
    133138        dataSet.addPrimitive(n);
    134139        listModel.addElement(n);
    135        
     140
    136141        w = new Way();
    137         w.setOsmId(2,1);
     142        w.setOsmId(2, 1);
    138143        w.put("name", "way.1");
    139144        dataSet.addPrimitive(w);
    140145        listModel.addElement(w);
    141        
     146
    142147        Relation r = new Relation();
    143         r.setOsmId(3,1);
     148        r.setOsmId(3, 1);
    144149        r.put("name", "relation.1");
    145150        dataSet.addPrimitive(r);
     
    147152    }
    148153
    149     public TurnRestrictionLegEditorTest(){
     154    public TurnRestrictionLegEditorTest() {
    150155        build();
    151156        initForTest2();
    152157    }
    153    
    154     static public void main(String args[]) {
     158
     159    public static void main(String[] args) {
    155160        new TurnRestrictionLegEditorTest().setVisible(true);
    156161    }
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java

    r30557 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    23
     
    1314/**
    1415 * Simple test application to test the vehicle exception editor
    15  * 
     16 *
    1617 */
    1718@Ignore("no test")
     
    2021    OsmDataLayer layer;
    2122    VehicleExceptionEditor editor;
    22    
     23
    2324    protected void build() {
    2425        Container c = getContentPane();
     
    2627        layer = new OsmDataLayer(new DataSet(), "test", null);
    2728
    28         model = new TurnRestrictionEditorModel(layer, new MockNavigationControler());       
     29        model = new TurnRestrictionEditorModel(layer, new MockNavigationControler());
    2930        editor = new VehicleExceptionEditor(model);
    3031        c.add(editor, BorderLayout.CENTER);
    31        
     32
    3233        model.getTagEditorModel().add(new TagModel("except", "non-standard-value"));
    3334    }
    34    
    35     public VehicleExceptionEditorTest(){
     35
     36    public VehicleExceptionEditorTest() {
    3637        build();
    3738        setDefaultCloseOperation(EXIT_ON_CLOSE);
    38         setSize(500,500);       
     39        setSize(500, 500);
    3940    }
    40    
    41     public static void main(String args[]){
     41
     42    public static void main(String[] args) {
    4243        new VehicleExceptionEditorTest().setVisible(true);
    4344    }
    44    
    45     static private class MockNavigationControler implements NavigationControler{
    4645
     46    private static class MockNavigationControler implements NavigationControler {
     47
     48        @Override
    4749        public void gotoAdvancedEditor() {
    4850            // TODO Auto-generated method stub
    49            
     51
    5052        }
    5153
     54        @Override
    5255        public void gotoBasicEditor() {
    5356            // TODO Auto-generated method stub
    54            
     57
    5558        }
    5659
     60        @Override
    5761        public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
    5862            // TODO Auto-generated method stub
    59            
     63
    6064        }
    6165    }
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java

    r30557 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.editor;
    23
     
    2425@Ignore("no test")
    2526public class ViaListTest extends JFrame {
    26    
     27
    2728    private TurnRestrictionEditorModel model;
    28    
     29
    2930    protected void build() {
    3031        DataSet ds = new DataSet();
    31         OsmDataLayer layer =new OsmDataLayer(ds, "test", null);
    32         // mock a controler 
     32        OsmDataLayer layer = new OsmDataLayer(ds, "test", null);
     33        // mock a controler
    3334        NavigationControler controler = new NavigationControler() {
     35            @Override
    3436            public void gotoAdvancedEditor() {
    3537            }
    3638
     39            @Override
    3740            public void gotoBasicEditor() {
    3841            }
    3942
     43            @Override
    4044            public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
    41             }           
     45            }
    4246        };
    4347        model = new TurnRestrictionEditorModel(layer, controler);
    4448        Container c = getContentPane();
    45        
     49
    4650        c.setLayout(new GridBagLayout());
    4751        GridBagConstraints gc = new GridBagConstraints();
    4852        gc.anchor = GridBagConstraints.NORTHWEST;
    49         gc.insets = new Insets(5,5,5,20);
     53        gc.insets = new Insets(5, 5, 5, 20);
    5054        gc.fill = GridBagConstraints.BOTH;
    5155        gc.weightx = 0.5;
    5256        gc.weighty = 1.0;
    53        
     57
    5458        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    5559        c.add(new ViaList(new ViaListModel(model, selectionModel), selectionModel), gc);
    56        
     60
    5761        gc.gridx = 1;
    5862        c.add(new JList<>(), gc);
    59        
    60         setSize(600,600);       
     63
     64        setSize(600, 600);
    6165        setDefaultCloseOperation(EXIT_ON_CLOSE);
    6266    }
    63    
     67
    6468    protected void initTest1() {
    6569        DataSet ds = new DataSet();
    6670        Relation r = new Relation();
    6771        Node n;
    68         for (int i = 1; i<10; i++){
    69             n = new Node(new LatLon(i,i)); 
     72        for (int i = 1; i < 10; i++) {
     73            n = new Node(new LatLon(i, i));
    7074            n.put("name", "node." + i);
    7175            ds.addPrimitive(n);
    72             r.addMember(new RelationMember("via",n));
    73         }       
     76            r.addMember(new RelationMember("via", n));
     77        }
    7478        model.populate(r);
    7579    }
    76    
     80
    7781    public ViaListTest() {
    78         build();       
     82        build();
    7983        initTest1();
    8084    }
    81    
    82     static public void main(String args[]) {
     85
     86    public static void main(String[] args) {
    8387        new ViaListTest().setVisible(true);
    8488    }
  • applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java

    r30737 r32519  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.plugins.turnrestrictions.qa;
    23
     
    2223public class IssuesViewTest extends JFrame {
    2324    private IssuesModel model;
    24    
     25
    2526    protected void build() {
    2627        Container c = getContentPane();
    2728        c.setLayout(new GridBagLayout());
    28         // mock a controler 
     29        // mock a controler
    2930        NavigationControler controler = new NavigationControler() {
     31            @Override
    3032            public void gotoAdvancedEditor() {
    3133            }
    3234
     35            @Override
    3336            public void gotoBasicEditor() {
    3437            }
    3538
     39            @Override
    3640            public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
    37             }           
     41            }
    3842        };
    3943        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "test", null);
     
    4953        pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    5054        c.add(pane, gc);
    51        
     55
    5256        List<Issue> issues = new ArrayList<>();
    5357        issues.add(new RequiredTagMissingError(model, "type", "restriction"));
     
    5559        model.populate(issues);
    5660    }
    57    
     61
    5862    public IssuesViewTest() {
    5963        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    60         setSize(400,600);
     64        setSize(400, 600);
    6165        build();
    6266    }
    63    
    64     public static void main(String args[]) {
     67
     68    public static void main(String[] args) {
    6569        new IssuesViewTest().setVisible(true);
    6670    }
Note: See TracChangeset for help on using the changeset viewer.