Index: applications/editors/josm/plugins/turnrestrictions/test/README
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/README	(revision 30532)
+++ applications/editors/josm/plugins/turnrestrictions/test/README	(revision 30550)
@@ -3,18 +3,7 @@
 
 
-src/             test sources (Unit tests, functional tests)
+unit/            test sources (Unit tests, functional tests)
 
 config/          configuration files for running tests
 
-                 Note: make sure this directory is on the classpath when unit tests
-                 are executed. Unit tests look for the configuration files
-                 'test-unit-env.properties'.
-                 
 data/            test data
-
-josm.home/       Some unit test have to run in the context of a running JOSM instance.
-                 This is the home directory for this JOSM instance. It includes 
-                 a preferences files with default entries. 
-
-lib/             Additional libraries used for testing
-
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/AllUnitTests.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/AllUnitTests.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/AllUnitTests.java	(revision 30550)
@@ -0,0 +1,12 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.AllEditorTests;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    AllEditorTests.class,
+    TurnRestrictionBuilderTest.class
+})
+public class AllUnitTests {}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilderTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilderTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilderTest.groovy	(revision 30550)
@@ -0,0 +1,645 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.util.Arrays;
+
+import groovy.util.GroovyTestCase;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.plugins.turnrestrictions.fixtures.JOSMFixture;
+import org.openstreetmap.josm.data.coor.LatLon;
+import static org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder.*
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionType;
+
+class TurnRestrictionBuilderTest{
+	
+	def TurnRestrictionBuilder builder;
+
+	def boolean hasExactlyOneMemberWithRole(Relation r, String role ){
+		return r.getMembers().find {RelationMember rm -> rm.getRole() == role} != null
+	}
+	
+	def memberWithRole(Relation r, String role) {
+		def RelationMember rm = r.getMembers().find {RelationMember rm -> rm.getRole() == role}
+		return rm.getMember()
+	}
+	
+	def void assertEmptyTurnRestriction(Relation r){
+		assert r != null
+		assert r.get("type") == "restriction"
+		assert r.getMembersCount() == 0
+	}
+	
+	@Before
+	public void setUp() {
+		JOSMFixture.createUnitTestFixture().init()
+		builder = new TurnRestrictionBuilder()
+	}
+
+	/**
+	 * Selection consist of one way and the start node of the way ->
+	 * propose a No-U-Turn restriction
+	 * 		
+	 */
+	@Test
+	public void noUTurn_1() {
+		Way w = new Way(1)
+		Node n1 = new Node(1)
+		Node n2 = new Node(2)
+		w.setNodes([n1,n2])
+		
+		def sel = [w,n1]
+		TurnRestrictionBuilder builder = new TurnRestrictionBuilder()
+		Relation r = builder.build(sel)  
+		
+		assert r != null
+		assert r.getMembersCount() == 3
+		assert hasExactlyOneMemberWithRole(r, "from")
+		assert hasExactlyOneMemberWithRole(r, "to")
+		assert hasExactlyOneMemberWithRole(r, "via")
+		assert memberWithRole(r, "from") == w
+		assert memberWithRole(r, "to") == w
+		assert memberWithRole(r, "via") == n1
+		assert r.get("restriction") == "no_u_turn"			
+	}
+	
+	
+	/**
+	* Selection consist of one way and the end node of the way ->
+	* propose a No-U-Turn restriction
+	*
+	*/
+   @Test
+   public void noUTurn_2() {
+	   Way w = new Way(1)
+	   Node n1 = new Node(1)
+	   Node n2 = new Node(2)
+	   w.setNodes([n1,n2])
+	   
+	   def sel = [w,n2]
+	   TurnRestrictionBuilder builder = new TurnRestrictionBuilder()
+	   Relation r = builder.build(sel)
+	   
+	   assert r != null
+	   assert r.getMembersCount() == 3
+	   assert hasExactlyOneMemberWithRole(r, "from")
+	   assert hasExactlyOneMemberWithRole(r, "to")
+	   assert hasExactlyOneMemberWithRole(r, "via")
+	   assert memberWithRole(r, "from") == w
+	   assert memberWithRole(r, "to") == w
+	   assert memberWithRole(r, "via") == n2
+	   assert r.get("restriction") == "no_u_turn"
+   }
+   
+   @Test
+   public void nullSelection() {
+	   def tr = builder.build(null)
+	   assertEmptyTurnRestriction(tr)
+   }
+   
+   @Test
+   public void emptySelection() {
+	   def tr = builder.build([])
+	   assertEmptyTurnRestriction(tr)
+   }
+   
+   /**
+    * One selected way -> build a turn restriction with a "from" leg
+    * only
+    */
+   @Test
+   public void oneSelectedWay() {
+	   Way w = new Way(1)
+	   Relation tr = builder.build([w])
+	   assert tr != null
+	   assert tr.get("type") == "restriction"
+	   assert tr.getMembersCount() == 1
+	   assert memberWithRole(tr, "from") == w
+   }   
+   
+   /**
+    * Two unconnected ways in the selection. The first one becomes the from leg,
+    * the second one the two leg.
+    */
+   @Test
+   public void twoUnconnectedWays() {
+	   Way w1 = new Way(1)
+	   w1.setNodes([new Node(11), new Node(12)])
+	   Way w2 = new Way(2)
+	   w2.setNodes([new Node(21), new Node(22)])
+	   
+	   Relation tr = builder.build([w1,w2])
+	   assert tr != null
+	   assert tr.get("type") == "restriction"
+	   assert ! tr.hasKey("restriction")
+	   assert tr.getMembersCount() == 2
+	   assert memberWithRole(tr, "from") == w1
+	   assert memberWithRole(tr, "to") == w2
+   }
+   
+   /**
+    * Two connected ways. end node of the first way connects to start node of 
+    * the second way. 
+    *       w2 
+    *    -------->
+    *    ^ 
+    *    | w1
+    *    |
+    */
+   @Test
+   public void twoConnectedWays_1() {
+	   Node n1 = new Node(1)
+	   n1.setCoor(new LatLon(1,1))
+	   Node n2 = new Node(2)
+	   n2.setCoor(new LatLon(2,1))
+	   Node n3 = new Node(3)
+	   n3.setCoor(new LatLon(2,2))
+	   
+	   Way w1 = new Way(1)
+	   w1.setNodes([n1,n2])
+	   Way w2 = new Way(2)
+	   w2.setNodes([n2,n3])
+
+	   assert builder.phi(w1) == Math.toRadians(90)	   
+	   assert builder.phi(w2) == Math.toRadians(0)
+	   	   
+	   Relation tr = builder.build([w1,w2,n2])
+	   
+	   assert tr != null
+	   assert tr.get("type") == "restriction"
+	   assert tr.getMembersCount() == 3
+	   assert memberWithRole(tr, "from") == w1
+	   assert memberWithRole(tr, "to") == w2
+	   assert memberWithRole(tr, "via") == n2
+	   
+	   assert tr.get("restriction") == "no_right_turn"
+	   	   
+	   /*
+	    * opposite order, from w2 to w1. In this case we have left turn.
+	    */
+	   
+	   tr = builder.build([w2,w1,n2])
+	   
+	   double a = interesectionAngle(w2, w1)
+	   println "a=" + Math.toDegrees(a)
+	   
+	   assert tr != null
+	   assert tr.get("type") == "restriction"
+	   assert tr.getMembersCount() == 3
+	   assert memberWithRole(tr, "from") == w2
+	   assert memberWithRole(tr, "to") == w1
+	   assert memberWithRole(tr, "via") == n2
+	   
+	   assert tr.get("restriction") == "no_left_turn"
+   }
+   
+   /**
+	* Two connected ways. end node of the first way connects to end node of
+	* the second way. left turn.
+	* 
+	*                   w2
+	*           (7,2) -------> (7,5)
+	*                            ^
+	*                            | w1
+	*                            |  
+	*                          (5,5)
+	*/
+   @Test
+   public void twoConnectedWays_2() {
+	   Node n1 = new Node(1)
+	   n1.setCoor(new LatLon(5,5))
+	   Node n2 = new Node(2)
+	   n2.setCoor(new LatLon(7,5))
+	   Node n3 = new Node(3)
+	   n3.setCoor(new LatLon(7,2))
+	   
+	   Way w1 = new Way(1)
+	   w1.setNodes([n1,n2])
+	   Way w2 = new Way(2)
+	   w2.setNodes([n3,n2])
+	   
+	   assert builder.phi(w1) == Math.toRadians(90)
+	   assert builder.phi(w2) == Math.toRadians(0)
+	   assert builder.phi(w2,true) == Math.toRadians(180)
+	   
+	   Relation tr = builder.build([w1,w2,n2])
+	   
+	   assert tr != null
+	   assert tr.get("type") == "restriction"
+	   assert tr.getMembersCount() == 3
+	   assert memberWithRole(tr, "from") == w1
+	   assert memberWithRole(tr, "to") == w2
+	   assert memberWithRole(tr, "via") == n2
+	   
+	   assert tr.get("restriction") == "no_left_turn"
+	   
+	   /*
+	    * opposite order, from w2 to w1. In this case we have right turn.
+	    */
+	   tr = builder.build([w2,w1,n2])
+	   
+	   assert tr != null
+	   assert tr.get("type") == "restriction"
+	   assert tr.getMembersCount() == 3
+	   assert memberWithRole(tr, "from") == w2
+	   assert memberWithRole(tr, "to") == w1
+	   assert memberWithRole(tr, "via") == n2	   
+	   assert tr.get("restriction") == "no_right_turn"
+   }
+   
+   /**
+   * Two connected ways. end node of the first way connects to end node of
+   * the second way. left turn.
+   *
+   *                 
+   *           (7,5) -
+   *             ^     -    w2
+   *             | w1     ------> (6,7)
+   *             |
+   *           (5,5)
+   */
+  @Test
+  public void twoConnectedWays_3() {
+	  Node n1 = new Node(1)
+	  n1.setCoor(new LatLon(5,5))
+	  Node n2 = new Node(2)
+	  n2.setCoor(new LatLon(7,5))
+	  Node n3 = new Node(3)
+	  n3.setCoor(new LatLon(6,7))
+	  
+	  Way w1 = new Way(1)
+	  w1.setNodes([n1,n2])
+	  Way w2 = new Way(2)
+	  w2.setNodes([n2,n3])
+	  	  	  
+	  Relation tr = builder.build([w1,w2,n2])
+	  
+	  assert tr != null
+	  assert tr.get("type") == "restriction"
+	  assert tr.getMembersCount() == 3
+	  assert memberWithRole(tr, "from") == w1
+	  assert memberWithRole(tr, "to") == w2
+	  assert memberWithRole(tr, "via") == n2
+	  
+	  assert tr.get("restriction") == "no_right_turn"	 
+  }
+  
+  
+  /**
+  * Two connected ways. end node of the first way connects to end node of
+  * the second way. left turn.
+  *
+  *           
+  *           (10,10)
+  *                 \                   
+  *                  \            
+  *                   \
+  *                    v           
+  *                     (8,15)
+  *                    /                     
+  *                   /
+  *                  /
+  *                 v
+  *            (5,11)
+  */
+ @Test
+ public void twoConnectedWays_4() {
+	 Node n1 = new Node(1)
+	 n1.setCoor(new LatLon(10,10))
+	 Node n2 = new Node(2)
+	 n2.setCoor(new LatLon(8,15))
+	 Node n3 = new Node(3)
+	 n3.setCoor(new LatLon(5,11))
+	 
+	 Way w1 = new Way(1)
+	 w1.setNodes([n1,n2])
+	 Way w2 = new Way(2)
+	 w2.setNodes([n2,n3])
+
+	 Relation tr = builder.build([w1,w2,n2])
+	 
+	 assert tr != null
+	 assert tr.get("type") == "restriction"
+	 assert tr.getMembersCount() == 3
+	 assert memberWithRole(tr, "from") == w1
+	 assert memberWithRole(tr, "to") == w2
+	 assert memberWithRole(tr, "via") == n2
+	 
+	 assert tr.get("restriction") == "no_right_turn"
+
+	 
+	 /*
+	  * opposite order, from w2 to w1. In  this case we have left turn.
+	  */
+	 tr = builder.build([w2,w1,n2])
+	 
+	 assert tr != null
+	 assert tr.get("type") == "restriction"
+	 assert tr.getMembersCount() == 3
+	 assert memberWithRole(tr, "from") == w2
+	 assert memberWithRole(tr, "to") == w1
+	 assert memberWithRole(tr, "via") == n2
+	 
+	 assert tr.get("restriction") == "no_left_turn"
+	}
+ 
+ 
+    def Node nn(id, lat, lon) {
+		Node n = new Node(id)
+		n.setCoor(new LatLon(lat, lon))
+		return n
+    }
+	
+	def Way nw(id, Node... nodes) {
+		Way w = new Way(id)
+		w.setNodes(Arrays.asList(nodes))
+		return w
+	}
+ 
+ 	/** 
+ 	 *                              n3
+ 	 *                           (10,10)
+ 	 *                             ^
+ 	 *                             | to
+ 	 *      n1      from           |
+ 	 *    (5,5) -------------->  (5,10) n2
+ 	 */
+	 @Test
+	 public void intersectionAngle_1() {
+		 Node n1 = nn(1,5,5)
+		 Node n2 = nn(2,5,10)
+		 Node n3 = nn(3,10,10)
+		 Way from = nw(1,n1,n2)
+		 Way to = nw(2,n2,n3)
+		 
+		 double a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		 RelativeWayJoinOrientation o = TurnRestrictionBuilder.determineWayJoinOrientation(from,to)
+		 assert Math.toDegrees(a) == -90
+		 assert o == RelativeWayJoinOrientation.LEFT
+		 
+		 /*
+		  * if reversed from, the intersection angle is still -90°
+		  */
+		 from = nw(1,n2,n1)
+		 to = nw(2,n2,n3)
+		 a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		 o = TurnRestrictionBuilder.determineWayJoinOrientation(from,to)
+		 assert Math.toDegrees(a) == -90
+		 assert o == RelativeWayJoinOrientation.LEFT
+
+		 /*
+		 * if reversed to, the intersection angle is still -90°
+		 */
+		 from = nw(1,n1,n2)
+		 to = nw(2,n3,n2)
+		 a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		 o = TurnRestrictionBuilder.determineWayJoinOrientation(from,to)
+		 assert Math.toDegrees(a) == -90
+		 assert o == RelativeWayJoinOrientation.LEFT
+
+		 /*
+		 * if reversed both, the intersection angle is still -90°
+		 */
+		 from = nw(1,n2,n1)
+		 to = nw(2,n3,n2)
+		 a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		 o = TurnRestrictionBuilder.determineWayJoinOrientation(from,to)
+		 assert Math.toDegrees(a) == -90
+		 assert o == RelativeWayJoinOrientation.LEFT
+	 }
+	 
+	 /**
+	 *      n1      from           
+	 *    (5,5) -------------->  (5,10) n2
+	 *                              |
+	 *                              | to
+	 *                              |
+	 *                              v
+	 *                            (2,10)
+	 *                              n3
+	 *    
+	 */
+	@Test
+	public void intersectionAngle_2() {
+		Node n1 = nn(1,5,5)
+		Node n2 = nn(2,5,10)
+		Node n3 = nn(3,2,10)
+		Way from = nw(1,n1,n2)
+		Way to = nw(2,n2,n3)
+		
+		double a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		assert Math.toDegrees(a) == 90
+		
+		/*
+		 * if reversed from, the intersection angle is still 90°
+		 */
+		from = nw(1,n2,n1)
+		to = nw(2,n2,n3)
+		a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		assert Math.toDegrees(a) == 90
+
+		/*
+		* if reversed to, the intersection angle is still 90°
+		*/
+		from = nw(1,n1,n2)
+		to = nw(2,n3,n2)
+		a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		assert Math.toDegrees(a) == 90
+
+		/*
+		* if reversed both, the intersection angle is still 90°
+		*/
+		from = nw(1,n2,n1)
+		to = nw(2,n3,n2)
+		a = TurnRestrictionBuilder.interesectionAngle(from, to)
+		assert Math.toDegrees(a) == 90
+	}
+	
+	
+	/**
+	 * 
+	 *                       
+	 *             (-1,-6) (n3)
+	 *             ^
+	 *            /
+	 *           /  to
+	 *          /
+	 *      (-5, -10) n2
+    *           ^
+	*           |
+	*           | from 
+	*           |
+	*       (-10,-10) n1 
+	*/
+   @Test
+   public void intersectionAngle_3() {
+	   Node n1 = nn(1,-10,-10)
+	   Node n2 = nn(2,-5,-10)
+	   Node n3 = nn(3,-1,-6)
+	   Way from = nw(1,n1,n2)
+	   Way to = nw(2,n2,n3)
+	   
+	   double a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	   assert Math.toDegrees(a) == 45
+	   
+	   /*
+		* if reversed from, the intersection angle is still 45
+		*/
+	   from = nw(1,n2,n1)
+	   to = nw(2,n2,n3)
+	   a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	   assert Math.toDegrees(a) == 45
+
+	   /*
+	   * if reversed to, the intersection angle is still 45
+	   */
+	   from = nw(1,n1,n2)
+	   to = nw(2,n3,n2)
+	   a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	   assert Math.toDegrees(a) == 45
+
+	   /*
+	   * if reversed both, the intersection angle is still 45
+	   */
+	   from = nw(1,n2,n1)
+	   to = nw(2,n3,n2)
+	   a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	   assert Math.toDegrees(a) == 45
+   }
+   
+   /**
+   *
+   *
+   *         (-1,-14) (n3)
+   *            ^
+   *            \
+   *             \ to
+   *              \
+   *          (-5, -10) n2
+  *               ^
+  *               |
+  *               | from
+  *               |
+  *           (-10,-10) n1
+  */
+ @Test
+ public void intersectionAngle_4() {
+	 Node n1 = nn(1,-10,-10)
+	 Node n2 = nn(2,-5,-10)
+	 Node n3 = nn(3,-1,-14)
+	 Way from = nw(1,n1,n2)
+	 Way to = nw(2,n2,n3)
+	 
+	 double a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	 assert Math.toDegrees(a) == -45
+	 
+	 /*
+	  * if reversed from, the intersection angle is still -45
+	  */
+	 from = nw(1,n2,n1)
+	 to = nw(2,n2,n3)
+	 a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	 assert Math.toDegrees(a) == -45
+
+	 /*
+	 * if reversed to, the intersection angle is still -45
+	 */
+	 from = nw(1,n1,n2)
+	 to = nw(2,n3,n2)
+	 a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	 assert Math.toDegrees(a) == -45
+
+	 /*
+	 * if reversed both, the intersection angle is still 45
+	 */
+	 from = nw(1,n2,n1)
+	 to = nw(2,n3,n2)
+	 a = TurnRestrictionBuilder.interesectionAngle(from, to)
+	 assert Math.toDegrees(a) == -45
+ }
+ 
+ 
+	 /*
+	 *
+	 *      n21        w21        n22       w22            n23
+	 *    (10,10)-------------> (10,15) -------------- > (10,20)
+	 *                            ^
+	 *                            |
+	 *                            | w1
+	 *                            |
+	 *                          (5,15)
+	 *                            n11
+	 */
+	@Test
+	public void splitToWay() {
+		Node n11 = new Node(11);
+		n11.setCoor(new LatLon(5,15));
+		
+		Node n21 = new Node(21)
+		n21.setCoor(new LatLon(10,10))
+		Node n22 = new Node(22)
+		n22.setCoor(new LatLon(10,15))
+		Node n23 = new Node(23)
+		n23.setCoor(new LatLon(10,20))
+		
+		Way w1 = new Way(1)
+		w1.setNodes([n11,n22])
+		Way w21 = new Way(21)
+		w21.setNodes([n21,n22])
+		Way w22 = new Way(22)
+		w22.setNodes([n22,n23])
+	
+		Way adjustedTo = selectToWayAfterSplit(
+			w1,
+			w21,
+			w22,
+			TurnRestrictionType.NO_LEFT_TURN
+		)
+		
+		assert adjustedTo != null
+		assert adjustedTo == w21
+		
+		adjustedTo = selectToWayAfterSplit(
+			w1,
+			w21,
+			w22,
+			TurnRestrictionType.NO_RIGHT_TURN
+		)
+		
+		assert adjustedTo != null
+		assert adjustedTo == w22
+		
+		adjustedTo = selectToWayAfterSplit(
+			w1,
+			w21,
+			w22,
+			TurnRestrictionType.ONLY_LEFT_TURN
+		)
+		
+		assert adjustedTo != null
+		assert adjustedTo == w21
+		
+		adjustedTo = selectToWayAfterSplit(
+			w1,
+			w21,
+			w22,
+			TurnRestrictionType.ONLY_RIGHT_TURN
+		)
+		
+		assert adjustedTo != null
+		assert adjustedTo == w22
+		
+		adjustedTo = selectToWayAfterSplit(
+			w1,
+			w21,
+			w22,
+			TurnRestrictionType.NO_STRAIGHT_ON
+		)
+		
+		assert adjustedTo == null
+	}	
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/AllEditorTests.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/AllEditorTests.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/AllEditorTests.java	(revision 30550)
@@ -0,0 +1,17 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import junit.framework.TestCase;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    JosmSelectionListModelTest.class,
+    TurnRestrictionEditorModelUnitTest.class,
+    TurnRestrictionLegEditorUnitTest.class,
+    TurnRestrictionTypeRendererTest.class,
+    TurnRestrictionTypeTest.class,
+    ExceptValueModelTest.class
+})
+public class AllEditorTests extends TestCase{}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanelTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanelTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanelTest.java	(revision 30550)
@@ -0,0 +1,49 @@
+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;
+
+/**
+ * Simple functional test for the layout / basic functionality of {@see BasicEditorPanel} 
+ *   
+ */
+public class BasicEditorPanelTest extends JFrame {
+
+    private TurnRestrictionEditorModel model;
+    private DataSet ds;
+    
+    public BasicEditorPanelTest() {
+        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);
+        
+        BasicEditorPanel panel = new BasicEditorPanel(model);
+        
+        Container c = getContentPane();
+        c.setLayout(new BorderLayout());
+        c.add(panel, BorderLayout.CENTER);      
+        setSize(600,600);
+        setDefaultCloseOperation(EXIT_ON_CLOSE);
+    }
+    
+    
+    static public void main(String args[]) {
+        new BasicEditorPanelTest().setVisible(true);
+    }
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModelTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModelTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModelTest.groovy	(revision 30550)
@@ -0,0 +1,70 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import org.junit.*;
+import static org.junit.Assert.*;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.ExceptValueModel;
+
+class ExceptValueModelTest {
+
+	@Test
+	public void constructor() {
+		new ExceptValueModel()
+		
+		def evm = new ExceptValueModel(null)
+		evm = new ExceptValueModel("")	
+		evm = new ExceptValueModel("  ")
+		evm = new ExceptValueModel("hgv")
+		evm = new ExceptValueModel("hgv;psv")
+		evm = new ExceptValueModel("non_standard")
+	}
+	
+	@Test
+	public void setValue() {
+		def evm
+		
+		// null value allowed - means no vehicle exceptions 
+		evm = new ExceptValueModel()
+		evm.setValue(null)
+		assert evm.getValue() == ""
+		assert evm.isStandard()
+		
+		// empty string allowed - means no vehicle expections 
+		evm = new ExceptValueModel()
+		evm.setValue("")
+		assert evm.getValue() == ""
+		assert evm.isStandard()
+
+		// a single standard vehicle exeption 
+		evm = new ExceptValueModel()
+		evm.setValue("hgv")
+		assert evm.getValue() == "hgv"
+		assert evm.isVehicleException("hgv")
+		assert ! evm.isVehicleException("psv")
+		assert evm.isStandard()
+
+		// two standard vehicle exceptions 
+		evm = new ExceptValueModel()
+		evm.setValue("hgv;psv")
+		assert evm.getValue() == "hgv;psv"
+		assert evm.isVehicleException("hgv")
+		assert evm.isVehicleException("psv")
+		assert evm.isStandard()
+		
+		// white space and lowercase/uppercase mix allowed. Should be normalized
+		// by the except value model
+		evm = new ExceptValueModel()
+		evm.setValue(" hGv ; PsV  ")
+		assert evm.getValue() == "hgv;psv"
+		assert evm.isVehicleException("hgv")
+		assert evm.isVehicleException("psv")
+		assert evm.isStandard()
+		
+		// non standard value allowed 
+		evm = new ExceptValueModel()
+		evm.setValue("Non Standard")
+		assert evm.getValue() == "Non Standard"
+		assert !evm.isVehicleException("hgv")
+		assert !evm.isVehicleException("psv")
+		assert !evm.isStandard()
+	}	 
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.groovy	(revision 30550)
@@ -0,0 +1,160 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import groovy.util.GroovyTestCase;
+
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import javax.swing.DefaultListSelectionModel;
+import org.openstreetmap.josm.data.osm.*;
+import org.openstreetmap.josm.data.coor.*;
+
+import org.openstreetmap.josm.plugins.turnrestrictions.fixtures.JOSMFixture;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+import javax.swing.JFrame;
+
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+
+/**
+ * Unit test for {@see JosmSelctionListModel}
+ */
+class JosmSelectionListModelTest extends GroovyTestCase {
+	final shouldFail = new GroovyTestCase().&shouldFail
+	
+	@Before
+	public void setUp() {
+		JOSMFixture.createUnitTestFixture().init()
+	}
+	
+	@Test
+	public void test_Constructor(){
+		DataSet ds = new DataSet()
+		OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
+		JosmSelectionListModel model = new JosmSelectionListModel(layer);		
+		
+		shouldFail(IllegalArgumentException){
+			model = new JosmSelectionListModel(null)
+		}
+	}
+	
+	@Test
+	public void test_setJOSMSelection() {
+		DataSet ds = new DataSet()
+		OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
+		JosmSelectionListModel model = new JosmSelectionListModel(layer);
+		
+		// set a selection with three objects 
+		def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]
+		model.setJOSMSelection objects
+		assert model.getSize() == 3
+		
+		// null is allowed 
+		model.setJOSMSelection(null)
+		assert model.getSize() == 0
+		assert model.getSelected().isEmpty()
+		
+		// empty has the same effect
+		model.setJOSMSelection([])
+		assert model.getSize() == 0
+		assert model.getSelected().isEmpty()
+	}
+	
+	@Test
+	public void test_setJOSMSelection_withSelected() {
+		DataSet ds = new DataSet()
+		OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
+		JosmSelectionListModel model = new JosmSelectionListModel(layer);
+		def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]	
+		model.setJOSMSelection(objects)
+		model.setSelected(objects[0..1])
+		assert model.getSelected().asList() as Set == objects[0..1] as Set
+		
+		// set new selection which includes one object which is currently
+        // selected in the model. Should still be selected after setting
+		// the new JOSM selection
+		objects = objects[1..2] 
+		model.setJOSMSelection(objects)
+		assert model.getSelected().asList() == [objects[0]]
+	}	
+	
+	@Test
+	public void test_getSelected() {
+		DataSet ds = new DataSet()
+		OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
+		
+		JosmSelectionListModel model = new JosmSelectionListModel(layer);
+		DefaultListSelectionModel selectionModel = model.getListSelectionModel()
+		
+		assert model.getSelected() != null
+		assert model.getSelected().isEmpty()
+	
+		// select one element 
+		def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]	
+		model.setJOSMSelection(objects)
+		selectionModel.setSelectionInterval(0, 0)
+		assert model.getSelected().asList() == [model.getElementAt(0)];
+		
+		// select two elements
+		selectionModel.setSelectionInterval(1,2)
+		assert model.getSelected().asList() as Set == [model.getElementAt(1),model.getElementAt(2)] as Set;
+	}
+	
+	@Test
+	public void test_setSelected() {
+		DataSet ds = new DataSet()
+		OsmDataLayer layer = new OsmDataLayer(ds, "test", null)
+		
+		// set selected with null is OK - nothing selected thereafter
+		JosmSelectionListModel model = new JosmSelectionListModel(layer);
+		DefaultListSelectionModel selectionModel = model.getListSelectionModel()
+		model.setSelected(null)
+		assert model.getSelected().isEmpty()
+		
+		// set selected with empty list is OK - nothing selected thereafter
+		model.setSelected([])
+		assert model.getSelected().isEmpty()
+		
+		// select an object existing in the list of displayed objects 
+		def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]	
+		model.setJOSMSelection(objects)
+		model.setSelected([objects[0]])
+		assert model.getSelected().asList() == [objects[0]];
+		
+		// select an object not-existing in the list of displayed objects 	
+		model.setJOSMSelection(objects)
+		model.setSelected([new Way()])
+		assert model.getSelected().isEmpty()
+	}
+	
+	@Test 
+	public void test_editLayerChanged() {
+		DataSet ds = new DataSet()
+			
+		def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()]	
+		objects.each {ds.addPrimitive(it)}
+		
+		OsmDataLayer layer1 = new OsmDataLayer(ds,"layer1", null)
+		OsmDataLayer layer2 = new OsmDataLayer(new DataSet(),"layer2", null)
+		
+		JosmSelectionListModel model = new JosmSelectionListModel(layer1);
+		DefaultListSelectionModel selectionModel = model.getListSelectionModel()
+		// switch from edit layer1 to edit layer2. content of the JOSM selection 
+		// should be empty thereafter 
+		model.editLayerChanged(layer1, layer2)
+		assert model.getSize() == 0
+		
+		// switch from layer2 to layer1 which has one object selected. Object should
+		// be displayed in the JOSM selection list 
+		ds.setSelected([objects[0]])
+		model.editLayerChanged(layer2, layer1)
+		assert model.getSize() == 1
+		assert model.getElementAt(0) == objects[0];
+		
+		// switch to a "null" edit layer (i.e. no edit layer)- nothing should
+		// be displayed in the selection list 
+		model.editLayerChanged(layer1, null)
+		assert model.getSize() == 0
+	}
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxTest.java	(revision 30550)
@@ -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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.groovy	(revision 30550)
@@ -0,0 +1,284 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+import groovy.util.GroovyTestCase;
+
+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.fixtures.JOSMFixture;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+import org.openstreetmap.josm.plugins.turnrestrictions.fixtures.JOSMFixture;
+
+/**
+ * This is a unit test for {@link TurnRestrictionEditorModel}
+ *
+ */
+class TurnRestrictionEditorModelUnitTest extends GroovyTestCase{
+
+	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() {
+		JOSMFixture.createUnitTestFixture().init()
+			
+		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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorTest.java	(revision 30550)
@@ -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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorTest.java	(revision 30550)
@@ -0,0 +1,155 @@
+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 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 TurnRestrictionLegEditor editor;
+    private TurnRestrictionEditorModel model;
+    private JList<OsmPrimitive> lstObjects;
+    private DefaultListModel<OsmPrimitive> 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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.groovy	(revision 30550)
@@ -0,0 +1,53 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import groovy.util.GroovyTestCase;
+
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+import org.openstreetmap.josm.plugins.turnrestrictions.fixtures.JOSMFixture;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+/**
+ * Unit test for the {@link TurnRestrictionLegEditor}
+ * 
+ */
+class TurnRestrictionLegEditorUnitTest extends GroovyTestCase {
+	final shouldFail = new GroovyTestCase().&shouldFail
+	
+	def navigationControlerMock = [
+       gotoBasicEditor:{}, 
+       gotoAdvancedEditor: {}
+	] as NavigationControler
+	
+	private DataSet ds
+	private OsmDataLayer layer
+	private TurnRestrictionEditorModel model 
+	
+	@Before
+	public void setUp() {
+		JOSMFixture.createUnitTestFixture().init()
+		
+		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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.groovy	(revision 30550)
@@ -0,0 +1,42 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.*;
+import org.junit.*;
+
+import groovy.util.GroovyTestCase;
+
+import java.awt.Component
+import org.openstreetmap.josm.plugins.turnrestrictions.fixtures.JOSMFixture;
+
+class TurnRestrictionTypeRendererTest extends GroovyTestCase{
+
+	@Before
+	public void setUp() {
+		JOSMFixture.createUnitTestFixture().init()			
+	}
+	
+	@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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.groovy
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.groovy	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.groovy	(revision 30550)
@@ -0,0 +1,20 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+import groovy.util.GroovyTestCase;
+
+import static org.junit.Assert.*;
+import org.junit.*
+class TurnRestrictionTypeTest extends GroovyTestCase{
+	
+	@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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditorTest.java	(revision 30550)
@@ -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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListTest.java	(revision 30550)
@@ -0,0 +1,83 @@
+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 TurnRestrictionEditorModel model;
+    
+    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(new ViaList(new ViaListModel(model, selectionModel), selectionModel), gc);
+        
+        gc.gridx = 1;
+        c.add(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/unit/org/openstreetmap/josm/plugins/turnrestrictions/fixtures/JOSMFixture.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/fixtures/JOSMFixture.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/fixtures/JOSMFixture.java	(revision 30550)
@@ -0,0 +1,76 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.fixtures;
+
+
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences;
+import org.openstreetmap.josm.data.projection.Projections;
+import org.openstreetmap.josm.io.OsmApi;
+import org.openstreetmap.josm.tools.I18n;
+
+public class JOSMFixture {
+    static private final Logger logger = Logger.getLogger(JOSMFixture.class.getName());
+
+    static public JOSMFixture createUnitTestFixture() {
+        return new JOSMFixture("/test-unit-env.properties");
+    }
+
+    private Properties testProperties;
+    private String testPropertiesResourceName;
+
+    public JOSMFixture(String testPropertiesResourceName) {
+        this.testPropertiesResourceName = testPropertiesResourceName;
+    }
+
+    public void init() {
+        testProperties = new Properties();
+     
+        // load properties
+        //
+        try {
+            testProperties.load(JOSMFixture.class.getResourceAsStream(testPropertiesResourceName));
+        } catch(Exception e){
+            logger.log(Level.SEVERE, MessageFormat.format("failed to load property file ''{0}''", testPropertiesResourceName));
+            fail(MessageFormat.format("failed to load property file ''{0}''. \nMake sure the path ''$project_root/test/config'' is on the classpath.", testPropertiesResourceName));
+        }
+
+        // check josm.home
+        //
+        String josmHome = testProperties.getProperty("josm.home");
+        if (josmHome == null) {
+            fail(MessageFormat.format("property ''{0}'' not set in test environment", "josm.home"));
+        } else {
+            File f = new File(josmHome);
+            if (! f.exists() || ! f.canRead()) {
+                fail(MessageFormat.format("property ''{0}'' points to ''{1}'' which is either not existing or not readable.\nEdit ''{2}'' and update the value ''josm.home''. ", "josm.home", josmHome,testPropertiesResourceName ));
+            }
+        }
+        System.setProperty("josm.home", josmHome);
+        Main.pref = new Preferences();
+        I18n.init();
+        // initialize the plaform hook, and
+        Main.determinePlatformHook();
+        // call the really early hook before we anything else
+        Main.platform.preStartupHook();
+
+        Main.pref.init(false);
+
+        // init projection
+        Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
+
+        // make sure we don't upload to or test against production
+        //
+        String url = OsmApi.getOsmApi().getBaseUrl().toLowerCase().trim();
+        if (url.startsWith("http://www.openstreetmap.org") || url.startsWith("http://api.openstreetmap.org")
+         || url.startsWith("https://www.openstreetmap.org") || url.startsWith("https://api.openstreetmap.org")) {
+            fail(MessageFormat.format("configured server url ''{0}'' seems to be a productive url, aborting.", url));
+        }
+    }
+}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java	(revision 30550)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesViewTest.java	(revision 30550)
@@ -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);
+    }
+}
