Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java	(revision 20606)
@@ -0,0 +1,61 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JFrame;
+
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * This is a simple test application to test the functionality/layout of 
+ * the {@see TurnRestrictionComboBox}
+ * 
+ */
+public class TurnRestrictionComboBoxTest extends JFrame {
+	
+	private TurnRestrictionEditorModel model;
+	private DataSet ds = new DataSet();
+	
+	protected void build() {
+		ds = new DataSet();
+		OsmDataLayer layer =new OsmDataLayer(ds, "test",null);
+		// mock a controler 
+		NavigationControler controler = new NavigationControler() {
+			public void gotoAdvancedEditor() {
+			}
+
+			public void gotoBasicEditor() {
+			}
+
+			public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+			}			
+		};
+		model = new TurnRestrictionEditorModel(layer, controler);
+		
+		Container c = getContentPane();
+		c.setLayout(new GridBagLayout());
+		GridBagConstraints gc = new GridBagConstraints();
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.fill = GridBagConstraints.HORIZONTAL;
+		gc.weightx = 1.0;
+		
+		TurnRestrictionComboBox cb = new TurnRestrictionComboBox(
+				new TurnRestrictionComboBoxModel(model)
+		);
+		add(cb, gc);		
+	}
+	
+	public TurnRestrictionComboBoxTest() {
+		build();
+		setSize(600,600);
+		setDefaultCloseOperation(EXIT_ON_CLOSE);
+	}
+	
+	public static void main(String args[]) {
+		new TurnRestrictionComboBoxTest().setVisible(true);
+	}
+
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.groovy	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.groovy	(revision 20606)
@@ -0,0 +1,278 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+import static org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionLegRole.*
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.data.osm.Relation
+import org.openstreetmap.josm.data.osm.RelationMember
+import org.openstreetmap.josm.data.osm.Node
+import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
+import org.openstreetmap.josm.data.osm.Way
+import org.openstreetmap.josm.data.osm.DataSet
+import org.openstreetmap.josm.data.coor.*
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * This is a unit test for {@see TurnRestrictionEditorModel}
+ *
+ */
+class TurnRestrictionEditorModelUnitTest {
+
+	final shouldFail = new GroovyTestCase().&shouldFail
+	
+	def navigationControlerMock = [
+       gotoBasicEditor:{}, 
+       gotoAdvancedEditor: {}
+	] as NavigationControler
+	 
+	private DataSet ds
+	private OsmDataLayer layer
+	private TurnRestrictionEditorModel model 
+	
+	def createNode(id = null, coor = null) {
+	    Node n
+	    if (id == null){
+	    	n = new Node()
+	    } else {
+	    	n = new Node(id)
+	    }
+	    if (coor != null) n.setCoor(coor)
+	    ds.addPrimitive(n)
+	    return n
+	}
+	
+	def createWay(id=null) {
+	    Way w
+	    if (id == null){
+	    	w = new Way()
+	    } else {
+	    	w = new Way(id)
+	    }
+	    ds.addPrimitive(w)
+	    return w
+	}
+	
+	def node(id){
+		return ds.getPrimitiveById(new SimplePrimitiveId(id, OsmPrimitiveType.NODE))
+	}
+	
+	def way(id) {
+		return ds.getPrimitiveById(new SimplePrimitiveId(id, OsmPrimitiveType.WAY))
+	}
+	
+	def rel(id){
+		return ds.getPrimitiveById(new SimplePrimitiveId(id, OsmPrimitiveType.RELATION))
+	}
+	
+	def rm(role,object){
+		return new RelationMember(role, object);
+	}
+	
+	def buildDataSet1() {		
+		// prepare some nodes and ways
+		createNode(21)
+		createNode(22)
+		createNode(31)
+		createNode(32)
+		createWay(2)
+		createWay(3)
+			
+		way(2).setNodes([node(21), node(22)])
+		way(3).setNodes([node(22), node(31)])
+		
+		// a standard turn restriction with a from, a to and a via
+		Relation r = new Relation(1)
+		r.setMembers([rm("from", way(2)), rm("to", way(3)), rm("via", node(22))])
+		r.put "type", "restriction"
+		r.put "restriction", "no_left_turn"		
+		ds.addPrimitive r
+	}
+	
+	@Before
+	public void setUp() {
+		ds = new DataSet()
+		layer = new OsmDataLayer(ds, "test", null)		
+		model = new TurnRestrictionEditorModel(layer, navigationControlerMock);
+	}
+	
+	
+	
+	/**
+	 * Test the constructor 
+	 */
+	@Test
+	public void test_Constructor() {		
+		shouldFail(IllegalArgumentException){
+			model = new TurnRestrictionEditorModel(null, navigationControlerMock);			
+		}
+
+		shouldFail(IllegalArgumentException){
+			model = new TurnRestrictionEditorModel(layer, null);			
+		}
+	}
+	
+	@Test
+	public void test_populate_EmptyTurnRestriction() {		
+		// an "empty" turn restriction with a public id 
+		Relation r = new Relation(1)
+		ds.addPrimitive r
+		assert model.getTurnRestrictionLeg(FROM).isEmpty()
+		assert model.getTurnRestrictionLeg(TO).isEmpty()
+		assert model.getVias().isEmpty()
+		assert model.getRestrictionTagValue() == ""
+	    assert model.getExcept().getValue() == ""
+	}
+	
+	/**
+	 * Populating the model with a simple default turn restriction: one from member (a way),
+	 * one to member (a way), one via (the common node of these ways), minimal tag set with
+	 * type=restriction and restriction=no_left_turn
+	 * 
+	 */
+	@Test
+	public void test_populate_SimpleStandardTurnRestriction() {		
+		buildDataSet1()		
+		model.populate(rel(1))
+		
+		assert model.getTurnRestrictionLeg(FROM).asList() == [way(2)]
+		assert model.getTurnRestrictionLeg(TO).asList() == [way(3)]
+		assert model.getVias() == [node(22)]
+		assert model.getRestrictionTagValue() == "no_left_turn"
+	    assert model.getExcept().getValue() == ""
+	}
+	
+	@Test
+	public void setFrom() {
+		buildDataSet1()		
+		model.populate(rel(1))
+		
+		createNode(41)
+		createNode(42)
+		createWay(4).setNodes([node(41),node(42)]);
+		
+		// set another way as from 
+		model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, way(4).getPrimitiveId())
+		assert model.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM).asList() == [way(4)];
+		
+		// delete the/all members with role 'from'
+		model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, null)
+		assert model.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM).isEmpty()
+		
+		
+		shouldFail(IllegalArgumentException) {
+			// can't add a node as 'from'
+			model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, node(21).getPrimitiveId())
+		}
+		
+		shouldFail(IllegalStateException) {
+			// can't set a way as 'from' if it isn't part of the dataset 
+			Way way = new Way() 
+			model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, way.getPrimitiveId())
+		}
+	}
+	
+	@Test
+	public void setTo() {
+		buildDataSet1()		
+		model.populate(rel(1))
+		
+		createNode(41)
+		createNode(42)
+		createWay(4).setNodes([node(41),node(42)]);
+		
+		// set another way as from 
+		model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, way(4).getPrimitiveId())
+		assert model.getTurnRestrictionLeg(TurnRestrictionLegRole.TO).asList() == [way(4)];
+		
+		// delete the/all members with role 'from'
+		model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, null)
+		assert model.getTurnRestrictionLeg(TurnRestrictionLegRole.TO).isEmpty()
+		
+		
+		shouldFail(IllegalArgumentException) {
+			// can't add a node as 'from'
+			model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, node(21).getPrimitiveId())
+		}
+		
+		shouldFail(IllegalStateException) {
+			// can't set a way as 'from' if it isn't part of the dataset 
+			Way way = new Way() 
+			model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, way.getPrimitiveId())
+		}
+	}
+	
+	/**
+	 * Test setting or deleting the tag 'restriction'
+	 */
+	@Test
+	public void setRestrictionTagValue() {
+		buildDataSet1()		
+		model.populate(rel(1))
+		
+		model.setRestrictionTagValue("no_left_turn")
+		assert model.getRestrictionTagValue() == "no_left_turn";
+		
+		model.setRestrictionTagValue(null)
+		assert model.getRestrictionTagValue() == "";
+		
+		model.setRestrictionTagValue("  ")
+		assert model.getRestrictionTagValue() == "";
+		
+		model.setRestrictionTagValue(" no_right_Turn ")
+		assert model.getRestrictionTagValue() == "no_right_turn";		
+	}
+	
+	/**
+	 * Test setting vias
+	 */
+	@Test
+	public void setVias() {
+		buildDataSet1()		
+		model.populate(rel(1))
+		
+		// one node as via - OK
+		model.setVias([node(22)])
+		assert model.getVias() == [node(22)];
+		
+		// pass in null as vias -> remove all vias 
+		model.setVias(null)
+		assert model.getVias().isEmpty()
+		
+		// pass in empty list -> remove all vias 
+		model.setVias([])
+		assert model.getVias().isEmpty()
+		
+		// create a list of vias with a way and twice a node (which doesn't
+		// make sense but is technically allowed)
+		//
+		createNode(41)
+		createNode(42)
+		createWay(4).setNodes([node(41), node(42)])
+		model.setVias([way(4), node(22), node(22)])
+		assert model.getVias() == [way(4), node(22), node(22)];
+
+        // null values in the list of vias are skipped 		                     
+        model.setVias([null, node(22)])
+        assert model.getVias() == [node(22)]
+                                   
+        shouldFail(IllegalArgumentException) {
+			// an object which doesn't belong to the same dataset can't
+			// be a via
+			Node n = new Node(new LatLon(0,0))
+			model.setVias([n])
+		}
+	}
+	
+	/**
+	 * Tests whether the three sub models exist
+	 */
+	@Test
+	public void submodelsExist() {
+		assert model.getIssuesModel() != null
+		assert model.getRelationMemberEditorModel() != null
+		assert model.getTagEditorModel() != null
+		
+		assert model.getLayer() == layer 
+	}	
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java	(revision 20606)
@@ -0,0 +1,25 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import javax.swing.JFrame;
+
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+/**
+ * Simple application to test functionality and layout of the turn restriction editor.
+ *
+ */
+public class TurnRestrictionEditorTest extends JFrame {
+	
+	public TurnRestrictionEditorTest() {
+		setSize(10,10);
+		TurnRestrictionEditor editor = new TurnRestrictionEditor(this, new OsmDataLayer(new DataSet(), "test", null));
+		editor.setSize(600,600);
+		editor.setVisible(true);
+		
+		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+	}
+	
+	static public void main(String args[]) {
+		new TurnRestrictionEditorTest().setVisible(true);
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java	(revision 20606)
@@ -0,0 +1,158 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.DefaultListModel;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.PrimitiveId;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.plugins.turnrestrictions.dnd.PrimitiveIdListProvider;
+import org.openstreetmap.josm.plugins.turnrestrictions.dnd.PrimitiveIdListTransferHandler;
+
+/**
+ * Simple test application to test functionality and layout of the 
+ * {@see TurnRestrictionLegEditor}
+ */
+public class TurnRestrictionLegEditorTest extends JFrame {
+	
+	private JTextArea taTest;
+	private TurnRestrictionLegEditor editor;
+	private TurnRestrictionEditorModel model;
+	private JList lstObjects;
+	private DefaultListModel listModel;
+	private DataSet dataSet;
+	
+	
+	protected JPanel buildLegEditorPanel() {
+		DataSet ds = new DataSet();
+		OsmDataLayer layer =new OsmDataLayer(ds, "test",null);
+		// mock a controler 
+		NavigationControler controler = new NavigationControler() {
+			public void gotoAdvancedEditor() {
+			}
+
+			public void gotoBasicEditor() {
+			}
+
+			public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+			}			
+		};
+		JPanel pnl = new JPanel(new GridBagLayout());
+		GridBagConstraints gc = new GridBagConstraints();
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.fill = GridBagConstraints.HORIZONTAL;
+		gc.weightx = 0.0;		
+		pnl.add(new JLabel("From"), gc);
+		
+		gc.weightx = 1.0;
+		gc.gridx = 1;
+		model = new TurnRestrictionEditorModel(layer, controler);
+		dataSet = new DataSet();
+		model.populate(new Relation());
+		pnl.add(editor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.FROM), gc);
+		
+		return pnl;
+	}
+	
+	protected JPanel buildObjectListPanel() {
+		JPanel pnl = new JPanel(new BorderLayout());
+		listModel = new DefaultListModel();
+		pnl.add(new JScrollPane(lstObjects = new JList(listModel)), BorderLayout.CENTER);
+		lstObjects.setCellRenderer(new OsmPrimitivRenderer());		
+		
+		PrimitiveIdListProvider provider = new PrimitiveIdListProvider() {			
+			public List<PrimitiveId> getSelectedPrimitiveIds() {
+				List<PrimitiveId> ret = new ArrayList<PrimitiveId>();
+				int [] sel = lstObjects.getSelectedIndices();
+				for (int i: sel){
+					ret.add(((OsmPrimitive)lstObjects.getModel().getElementAt(i)).getPrimitiveId());
+				}
+				return ret;
+			}
+		};
+		
+		lstObjects.setTransferHandler(new PrimitiveIdListTransferHandler(provider));
+		lstObjects.setDragEnabled(true);
+		return pnl;
+	}
+	
+	protected void build() {
+		Container c = getContentPane();
+		c.setLayout(new GridBagLayout());
+		
+		GridBagConstraints gc = new GridBagConstraints();
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.fill = GridBagConstraints.HORIZONTAL;	
+		gc.insets = new Insets(20, 0, 20, 0);
+		gc.weightx = 1.0;		
+		gc.weighty = 0.0;
+		add(buildLegEditorPanel(), gc);
+		
+		gc.gridy = 1;
+		gc.weightx = 1.0;
+		gc.weighty = 1.0;
+		gc.fill = GridBagConstraints.BOTH;
+		add(buildObjectListPanel(), gc);
+		setSize(600,600);	
+	}
+	
+	protected void initForTest1() {
+		Way w = new Way(1);
+		w.put("name", "way-1");
+		
+		editor.getModel().setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, w);
+	}
+	
+	protected void initForTest2() {
+		Way w = new Way(1);
+		w.put("name", "way-1");		
+		dataSet.addPrimitive(w);
+		editor.getModel().setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, w);
+		
+		Node n = new Node(new LatLon(1,1));
+		n.setOsmId(1, 1);
+		n.put("name", "node.1");
+		dataSet.addPrimitive(n);
+		listModel.addElement(n);
+		
+		w = new Way();
+		w.setOsmId(2,1);
+		w.put("name", "way.1");
+		dataSet.addPrimitive(w);
+		listModel.addElement(w);
+		
+		Relation r = new Relation();
+		r.setOsmId(3,1);
+		r.put("name", "relation.1");
+		dataSet.addPrimitive(r);
+		listModel.addElement(r);
+	}
+
+	public TurnRestrictionLegEditorTest(){
+		build();
+		initForTest2();
+	}
+	
+	static public void main(String args[]) {
+		new TurnRestrictionLegEditorTest().setVisible(true);
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.groovy	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.groovy	(revision 20606)
@@ -0,0 +1,46 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+/**
+ * Unit test for the {@see TurnRestrictionLegEditor}
+ * 
+ */
+class TurnRestrictionLegEditorUnitTest {
+	final shouldFail = new GroovyTestCase().&shouldFail
+	
+	def navigationControlerMock = [
+       gotoBasicEditor:{}, 
+       gotoAdvancedEditor: {}
+	] as NavigationControler
+	
+	private DataSet ds
+	private OsmDataLayer layer
+	private TurnRestrictionEditorModel model 
+	
+	@Before
+	public void setUp() {
+		ds = new DataSet()
+		layer = new OsmDataLayer(ds, "test", null)		
+		model = new TurnRestrictionEditorModel(layer, navigationControlerMock);
+	}
+	 
+	@Test
+	public void test_Constructor() {
+		
+		TurnRestrictionLegEditor editor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.FROM)
+		
+		assert editor.getModel() == model
+		assert editor.getRole() == TurnRestrictionLegRole.FROM
+		
+		shouldFail(IllegalArgumentException) {
+			editor = new TurnRestrictionLegEditor(null, TurnRestrictionLegRole.FROM)
+		}
+
+		shouldFail(IllegalArgumentException) {
+			editor = new TurnRestrictionLegEditor(model, null)
+		}
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.groovy	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.groovy	(revision 20606)
@@ -0,0 +1,33 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+import java.awt.Component
+
+class TurnRestrictionTypeRendererTest {
+
+	@Test
+	public void test_Constructor() {
+		TurnRestrictionTypeRenderer renderer = new TurnRestrictionTypeRenderer();
+		
+		assert renderer.@icons != null
+		assert renderer.@icons.get(TurnRestrictionType.NO_LEFT_TURN) != null
+	}
+	
+	@Test
+	public void test_getListCellRendererComponent_1() {
+		TurnRestrictionTypeRenderer renderer = new TurnRestrictionTypeRenderer();
+		
+		def c = renderer.getListCellRendererComponent(null, null, 0, false, false)		
+		assert c.getIcon() == null
+		assert c.getText() != null
+		
+		c = renderer.getListCellRendererComponent(null, "non-standard-value", 0, false, false)		
+		assert c.getIcon() == null
+		assert c.getText() == "non-standard-value"	
+
+		c = renderer.getListCellRendererComponent(null, TurnRestrictionType.NO_LEFT_TURN, 0, false, false)		
+		assert c.getIcon() == renderer.@icons.get(TurnRestrictionType.NO_LEFT_TURN)
+		assert c.getText() == TurnRestrictionType.NO_LEFT_TURN.getDisplayName()
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.groovy	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.groovy	(revision 20606)
@@ -0,0 +1,20 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.*;
+import org.junit.*
+class TurnRestrictionTypeTest {
+	
+	@Test
+	public void test_fromTagValue() {
+		
+		TurnRestrictionType type = TurnRestrictionType.fromTagValue("no_left_turn")
+		assert type == TurnRestrictionType.NO_LEFT_TURN
+		
+		type = TurnRestrictionType.fromTagValue("doesnt_exist")
+		assert type == null
+		
+		type = TurnRestrictionType.fromTagValue(null)
+		assert type == null
+	}
+
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java	(revision 20606)
@@ -0,0 +1,60 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+
+import javax.swing.JFrame;
+
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.gui.tagging.TagModel;
+
+/**
+ * Simple test application to test the vehicle exception editor
+ * 
+ */
+public class VehicleExceptionEditorTest extends JFrame {
+	TurnRestrictionEditorModel model;
+	OsmDataLayer layer;
+	VehicleExceptionEditor editor;
+	
+	protected void build() {
+		Container c = getContentPane();
+		c.setLayout(new BorderLayout());
+		layer = new OsmDataLayer(new DataSet(), "test", null);
+
+		model = new TurnRestrictionEditorModel(layer, new MockNavigationControler());		
+		editor = new VehicleExceptionEditor(model);
+		c.add(editor, BorderLayout.CENTER);
+		
+		model.getTagEditorModel().add(new TagModel("except", "non-standard-value"));
+	}
+	
+	public VehicleExceptionEditorTest(){
+		build();
+		setDefaultCloseOperation(EXIT_ON_CLOSE);
+		setSize(500,500);		
+	}
+	
+	public static void main(String args[]){
+		new VehicleExceptionEditorTest().setVisible(true);
+	}
+	
+	static private class MockNavigationControler implements NavigationControler{
+
+		public void gotoAdvancedEditor() {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void gotoBasicEditor() {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+			// TODO Auto-generated method stub
+			
+		}
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java	(revision 20606)
@@ -0,0 +1,86 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.JFrame;
+import javax.swing.JList;
+
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * Simple test application to test the via list editor
+ *
+ */
+public class ViaListTest  extends JFrame{
+	
+	private ViaList lstVias;
+	private TurnRestrictionEditorModel model;
+	private JList lstJOSMSelection;
+	
+	
+	protected void build() {
+		DataSet ds = new DataSet();
+		OsmDataLayer layer =new OsmDataLayer(ds, "test",null);
+		// mock a controler 
+		NavigationControler controler = new NavigationControler() {
+			public void gotoAdvancedEditor() {
+			}
+
+			public void gotoBasicEditor() {
+			}
+
+			public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+			}			
+		};
+		model = new TurnRestrictionEditorModel(layer, controler);
+		Container c = getContentPane();
+		
+		c.setLayout(new GridBagLayout());
+		GridBagConstraints gc = new GridBagConstraints();
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.insets = new Insets(5,5,5,20);
+		gc.fill = GridBagConstraints.BOTH;
+		gc.weightx = 0.5;
+		gc.weighty = 1.0;
+		
+		DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
+		c.add(lstVias = new ViaList(new ViaListModel(model, selectionModel), selectionModel), gc);
+		
+		gc.gridx = 1;
+		c.add(lstJOSMSelection = new JList(), gc);
+		
+		setSize(600,600);		
+		setDefaultCloseOperation(EXIT_ON_CLOSE);
+	}
+	
+	protected void initTest1() {
+		DataSet ds = new DataSet();
+		Relation r = new Relation();
+		Node n;
+		for (int i = 1; i<10; i++){
+			n = new Node(new LatLon(i,i));	
+			n.put("name", "node." + i);
+			ds.addPrimitive(n);
+			r.addMember(new RelationMember("via",n));
+		}		
+		model.populate(r);
+	}
+	
+	public ViaListTest() {
+		build();		
+		initTest1();
+	}
+	
+	static public void main(String args[]) {
+		new ViaListTest().setVisible(true);
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java	(revision 20606)
+++ applications/editors/josm/plugins/turnrestrictions/test/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java	(revision 20606)
@@ -0,0 +1,65 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.qa;
+
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.NavigationControler;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorModel;
+
+/**
+ * Simple test application for layout and functionality of the issues view.
+ */
+public class IssuesViewTest extends JFrame {
+	private IssuesModel model;
+	
+	protected void build() {
+		Container c = getContentPane();
+		c.setLayout(new GridBagLayout());
+		// mock a controler 
+		NavigationControler controler = new NavigationControler() {
+			public void gotoAdvancedEditor() {
+			}
+
+			public void gotoBasicEditor() {
+			}
+
+			public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+			}			
+		};
+		OsmDataLayer layer = new OsmDataLayer(new DataSet(), "test", null);
+		TurnRestrictionEditorModel editorModel = new TurnRestrictionEditorModel(layer, controler);
+		model = new IssuesModel(editorModel);
+		GridBagConstraints gc = new GridBagConstraints();
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.fill = GridBagConstraints.BOTH;
+		gc.weightx = 1.0;
+		gc.weighty = 1.0;
+		JScrollPane pane = new JScrollPane(new IssuesView(model));
+		pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+		pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+		c.add(pane, gc);
+		
+		List<Issue> issues = new ArrayList<Issue>();
+		issues.add(new RequiredTagMissingError(model, "type", "restriction"));
+		issues.add(new MissingRestrictionTypeError(model));
+		model.populate(issues);
+	}
+	
+	public IssuesViewTest() {
+		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+		setSize(400,600);
+		build();
+	}
+	
+	public static void main(String args[]) {
+		new IssuesViewTest().setVisible(true);
+	}
+}
