Index: applications/editors/josm/plugins/turnrestrictions/.classpath
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/.classpath	(revision 32924)
+++ applications/editors/josm/plugins/turnrestrictions/.classpath	(revision 32925)
@@ -3,9 +3,7 @@
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="test/unit"/>
-	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
-	<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
 	<classpathentry kind="output" path="build"/>
 </classpath>
Index: applications/editors/josm/plugins/turnrestrictions/.project
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/.project	(revision 32924)
+++ applications/editors/josm/plugins/turnrestrictions/.project	(revision 32925)
@@ -23,5 +23,4 @@
 	</buildSpec>
 	<natures>
-		<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
Index: applications/editors/josm/plugins/turnrestrictions/.settings/org.eclipse.core.resources.prefs
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/.settings/org.eclipse.core.resources.prefs	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/.settings/org.eclipse.core.resources.prefs	(revision 32925)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java	(revision 32924)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java	(revision 32925)
@@ -21,5 +21,5 @@
 public class TurnRestrictionTypeRenderer extends JLabel implements ListCellRenderer<Object> {
 
-    private final Map<TurnRestrictionType, ImageIcon> icons = new HashMap<>();
+    final Map<TurnRestrictionType, ImageIcon> icons = new HashMap<>();
     private String iconSet = "set-a";
 
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 32924)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 32925)
@@ -120,5 +120,5 @@
      * Launches an external browser with the sponsors home page
      */
-    class SkobblerUrlLauncher extends MouseAdapter implements HyperlinkListener {
+    static class SkobblerUrlLauncher extends MouseAdapter implements HyperlinkListener {
         protected void launchBrowser() {
             OpenBrowser.displayUrl("http://www.skobbler.de");
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 32924)
+++ 	(revision )
@@ -1,639 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions;
-
-import static org.junit.Assert.*
-import static org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder.*
-
-import org.junit.*
-import org.openstreetmap.josm.data.coor.LatLon
-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.data.osm.Way
-import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionType
-import org.openstreetmap.josm.testutils.JOSMTestRules
-
-class TurnRestrictionBuilderTest{
-
-    @Rule
-    public JOSMTestRules rules = new JOSMTestRules().preferences();
-
-    def TurnRestrictionBuilder builder = new TurnRestrictionBuilder();
-
-    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
-    }
-
-    /**
-     * 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 = intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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.intersectionAngle(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/TurnRestrictionBuilderTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilderTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilderTest.java	(revision 32925)
@@ -0,0 +1,648 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder.intersectionAngle;
+import static org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder.selectToWayAfterSplit;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder.RelativeWayJoinOrientation;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionType;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+public class TurnRestrictionBuilderTest {
+
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences();
+
+    TurnRestrictionBuilder builder = new TurnRestrictionBuilder();
+
+    boolean hasExactlyOneMemberWithRole(Relation r, final String role) {
+        return r.getMembers().stream().filter(rm -> role.equals(rm.getRole())).findFirst().isPresent();
+    }
+
+    OsmPrimitive memberWithRole(Relation r, final String role) {
+        Optional<RelationMember> opt = r.getMembers().stream().filter(rm -> role.equals(rm.getRole())).findFirst();
+        if (!opt.isPresent())
+            return null;
+        return opt.get().getMember();
+    }
+
+    static void assertEmptyTurnRestriction(Relation r) {
+        assertNotNull(r);
+        assertEquals("restriction", r.get("type"));
+        assertEquals(0, r.getMembersCount());
+    }
+
+    /**
+     * 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(Arrays.asList(n1, n2));
+
+        List<OsmPrimitive> sel = Arrays.asList(w, n1);
+        TurnRestrictionBuilder builder = new TurnRestrictionBuilder();
+        Relation r = builder.build(sel);
+
+        assertNotNull(r);
+        assertEquals(3, r.getMembersCount());
+        assertTrue(hasExactlyOneMemberWithRole(r, "from"));
+        assertTrue(hasExactlyOneMemberWithRole(r, "to"));
+        assertTrue(hasExactlyOneMemberWithRole(r, "via"));
+        assertEquals(w, memberWithRole(r, "from"));
+        assertEquals(w, memberWithRole(r, "to"));
+        assertEquals(n1, memberWithRole(r, "via"));
+        assertEquals("no_u_turn", r.get("restriction"));
+    }
+
+    /**
+    * 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(Arrays.asList(n1, n2));
+
+       List<OsmPrimitive> sel = Arrays.asList(w, n2);
+       TurnRestrictionBuilder builder = new TurnRestrictionBuilder();
+       Relation r = builder.build(sel);
+
+       assertNotNull(r);
+       assertEquals(3, r.getMembersCount());
+       assertTrue(hasExactlyOneMemberWithRole(r, "from"));
+       assertTrue(hasExactlyOneMemberWithRole(r, "to"));
+       assertTrue(hasExactlyOneMemberWithRole(r, "via"));
+       assertEquals(w, memberWithRole(r, "from"));
+       assertEquals(w, memberWithRole(r, "to"));
+       assertEquals(n2, memberWithRole(r, "via"));
+       assertEquals("no_u_turn", r.get("restriction"));
+   }
+
+   @Test
+   public void nullSelection() {
+       assertEmptyTurnRestriction(builder.build(null));
+   }
+
+   @Test
+   public void emptySelection() {
+       assertEmptyTurnRestriction(builder.build(new ArrayList<>()));
+   }
+
+   /**
+    * 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(Arrays.asList(w));
+       assertNotNull(tr);
+       assertEquals("restriction", tr.get("type"));
+       assertEquals(1, tr.getMembersCount());
+       assertEquals(w, memberWithRole(tr, "from"));
+   }
+
+   /**
+    * 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(Arrays.asList(new Node(11), new Node(12)));
+       Way w2 = new Way(2);
+       w2.setNodes(Arrays.asList(new Node(21), new Node(22)));
+
+       Relation tr = builder.build(Arrays.asList(w1, w2));
+       assertNotNull(tr);
+       assertEquals("restriction", tr.get("type"));
+       assertFalse(tr.hasKey("restriction"));
+       assertEquals(2, tr.getMembersCount());
+       assertEquals(w1, memberWithRole(tr, "from"));
+       assertEquals(w2, memberWithRole(tr, "to"));
+   }
+
+   /**
+    * 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(Arrays.asList(n1, n2));
+       Way w2 = new Way(2);
+       w2.setNodes(Arrays.asList(n2, n3));
+
+       assertEquals(Math.toRadians(90), TurnRestrictionBuilder.phi(w1), 1e-7);
+       assertEquals(Math.toRadians(0), TurnRestrictionBuilder.phi(w2), 1e-7);
+
+       Relation tr = builder.build(Arrays.asList(w1, w2, n2));
+
+       assertNotNull(tr);
+       assertEquals("restriction", tr.get("type"));
+       assertEquals(3, tr.getMembersCount());
+       assertEquals(w1, memberWithRole(tr, "from"));
+       assertEquals(w2, memberWithRole(tr, "to"));
+       assertEquals(n2, memberWithRole(tr, "via"));
+
+       assertEquals("no_right_turn", tr.get("restriction"));
+
+       /*
+        * opposite order, from w2 to w1. In this case we have left turn.
+        */
+
+       tr = builder.build(Arrays.asList(w2, w1, n2));
+
+       double a = intersectionAngle(w2, w1);
+       System.out.println("a=" + Math.toDegrees(a));
+
+       assertNotNull(tr);
+       assertEquals("restriction", tr.get("type"));
+       assertEquals(3, tr.getMembersCount());
+       assertEquals(w2, memberWithRole(tr, "from"));
+       assertEquals(w1, memberWithRole(tr, "to"));
+       assertEquals(n2, memberWithRole(tr, "via"));
+
+       assertEquals("no_left_turn", tr.get("restriction"));
+   }
+
+   /**
+    * 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(Arrays.asList(n1, n2));
+       Way w2 = new Way(2);
+       w2.setNodes(Arrays.asList(n3, n2));
+
+       assertEquals(Math.toRadians(90), TurnRestrictionBuilder.phi(w1), 1e-7);
+       assertEquals(Math.toRadians(0), TurnRestrictionBuilder.phi(w2), 1e-7);
+       assertEquals(Math.toRadians(180), TurnRestrictionBuilder.phi(w2, true), 1e-7);
+
+       Relation tr = builder.build(Arrays.asList(w1, w2, n2));
+
+       assertNotNull(tr);
+       assertEquals("restriction", tr.get("type"));
+       assertEquals(3, tr.getMembersCount());
+       assertEquals(w1, memberWithRole(tr, "from"));
+       assertEquals(w2, memberWithRole(tr, "to"));
+       assertEquals(n2, memberWithRole(tr, "via"));
+
+       assertEquals("no_left_turn", tr.get("restriction"));
+
+       /*
+        * opposite order, from w2 to w1. In this case we have right turn.
+        */
+       tr = builder.build(Arrays.asList(w2, w1, n2));
+
+       assertNotNull(tr);
+       assertEquals("restriction", tr.get("type"));
+       assertEquals(3, tr.getMembersCount());
+       assertEquals(w2, memberWithRole(tr, "from"));
+       assertEquals(w1, memberWithRole(tr, "to"));
+       assertEquals(n2, memberWithRole(tr, "via"));
+       assertEquals("no_right_turn", tr.get("restriction"));
+   }
+
+   /**
+   * 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(Arrays.asList(n1, n2));
+      Way w2 = new Way(2);
+      w2.setNodes(Arrays.asList(n2, n3));
+
+      Relation tr = builder.build(Arrays.asList(w1, w2, n2));
+
+      assertNotNull(tr);
+      assertEquals("restriction", tr.get("type"));
+      assertEquals(3, tr.getMembersCount());
+      assertEquals(w1, memberWithRole(tr, "from"));
+      assertEquals(w2, memberWithRole(tr, "to"));
+      assertEquals(n2, memberWithRole(tr, "via"));
+
+      assertEquals("no_right_turn", tr.get("restriction"));
+  }
+
+  /**
+  * 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(Arrays.asList(n1, n2));
+     Way w2 = new Way(2);
+     w2.setNodes(Arrays.asList(n2, n3));
+
+     Relation tr = builder.build(Arrays.asList(w1, w2, n2));
+
+     assertNotNull(tr);
+     assertEquals("restriction", tr.get("type"));
+     assertEquals(3, tr.getMembersCount());
+     assertEquals(w1, memberWithRole(tr, "from"));
+     assertEquals(w2, memberWithRole(tr, "to"));
+     assertEquals(n2, memberWithRole(tr, "via"));
+
+     assertEquals("no_right_turn", tr.get("restriction"));
+
+     /*
+      * opposite order, from w2 to w1. In  this case we have left turn.
+      */
+     tr = builder.build(Arrays.asList(w2, w1, n2));
+
+     assertNotNull(tr);
+     assertEquals("restriction", tr.get("type"));
+     assertEquals(3, tr.getMembersCount());
+     assertEquals(w2, memberWithRole(tr, "from"));
+     assertEquals(w1, memberWithRole(tr, "to"));
+     assertEquals(n2, memberWithRole(tr, "via"));
+
+     assertEquals("no_left_turn", tr.get("restriction"));
+    }
+
+    static Node nn(long id, double lat, double lon) {
+        Node n = new Node(id);
+        n.setCoor(new LatLon(lat, lon));
+        return n;
+    }
+
+    static Way nw(long 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.intersectionAngle(from, to);
+         RelativeWayJoinOrientation o = TurnRestrictionBuilder.determineWayJoinOrientation(from, to);
+         assertEquals(-90, Math.toDegrees(a), 1e-7);
+         assertEquals(RelativeWayJoinOrientation.LEFT, o);
+
+         /*
+          * if reversed from, the intersection angle is still -90
+          */
+         from = nw(1, n2, n1);
+         to = nw(2, n2, n3);
+         a = TurnRestrictionBuilder.intersectionAngle(from, to);
+         o = TurnRestrictionBuilder.determineWayJoinOrientation(from, to);
+         assertEquals(-90, Math.toDegrees(a), 1e-7);
+         assertEquals(RelativeWayJoinOrientation.LEFT, o);
+
+         /*
+         * if reversed to, the intersection angle is still -90
+         */
+         from = nw(1, n1, n2);
+         to = nw(2, n3, n2);
+         a = TurnRestrictionBuilder.intersectionAngle(from, to);
+         o = TurnRestrictionBuilder.determineWayJoinOrientation(from, to);
+         assertEquals(-90, Math.toDegrees(a), 1e-7);
+         assertEquals(RelativeWayJoinOrientation.LEFT, o);
+
+         /*
+         * if reversed both, the intersection angle is still -90
+         */
+         from = nw(1, n2, n1);
+         to = nw(2, n3, n2);
+         a = TurnRestrictionBuilder.intersectionAngle(from, to);
+         o = TurnRestrictionBuilder.determineWayJoinOrientation(from, to);
+         assertEquals(-90, Math.toDegrees(a), 1e-7);
+         assertEquals(RelativeWayJoinOrientation.LEFT, o);
+     }
+
+     /**
+     *      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.intersectionAngle(from, to);
+        assertEquals(90, Math.toDegrees(a), 1e-7);
+
+        /*
+         * if reversed from, the intersection angle is still 90
+         */
+        from = nw(1, n2, n1);
+        to = nw(2, n2, n3);
+        a = TurnRestrictionBuilder.intersectionAngle(from, to);
+        assertEquals(90, Math.toDegrees(a), 1e-7);
+
+        /*
+        * if reversed to, the intersection angle is still 90
+        */
+        from = nw(1, n1, n2);
+        to = nw(2, n3, n2);
+        a = TurnRestrictionBuilder.intersectionAngle(from, to);
+        assertEquals(90, Math.toDegrees(a), 1e-7);
+
+        /*
+        * if reversed both, the intersection angle is still 90
+        */
+        from = nw(1, n2, n1);
+        to = nw(2, n3, n2);
+        a = TurnRestrictionBuilder.intersectionAngle(from, to);
+        assertEquals(90, Math.toDegrees(a), 1e-7);
+    }
+
+    /**
+     *
+     *
+     *             (-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.intersectionAngle(from, to);
+       assertEquals(45, Math.toDegrees(a), 1e-7);
+
+       /*
+        * if reversed from, the intersection angle is still 45
+        */
+       from = nw(1, n2, n1);
+       to = nw(2, n2, n3);
+       a = TurnRestrictionBuilder.intersectionAngle(from, to);
+       assertEquals(45, Math.toDegrees(a), 1e-7);
+
+       /*
+       * if reversed to, the intersection angle is still 45
+       */
+       from = nw(1, n1, n2);
+       to = nw(2, n3, n2);
+       a = TurnRestrictionBuilder.intersectionAngle(from, to);
+       assertEquals(45, Math.toDegrees(a), 1e-7);
+
+       /*
+       * if reversed both, the intersection angle is still 45
+       */
+       from = nw(1, n2, n1);
+       to = nw(2, n3, n2);
+       a = TurnRestrictionBuilder.intersectionAngle(from, to);
+       assertEquals(45, Math.toDegrees(a), 1e-7);
+   }
+
+   /**
+   *
+   *
+   *         (-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.intersectionAngle(from, to);
+     assertEquals(-45, Math.toDegrees(a), 1e-7);
+
+     /*
+      * if reversed from, the intersection angle is still -45
+      */
+     from = nw(1, n2, n1);
+     to = nw(2, n2, n3);
+     a = TurnRestrictionBuilder.intersectionAngle(from, to);
+     assertEquals(-45, Math.toDegrees(a), 1e-7);
+
+     /*
+     * if reversed to, the intersection angle is still -45
+     */
+     from = nw(1, n1, n2);
+     to = nw(2, n3, n2);
+     a = TurnRestrictionBuilder.intersectionAngle(from, to);
+     assertEquals(-45, Math.toDegrees(a), 1e-7);
+
+     /*
+     * if reversed both, the intersection angle is still 45
+     */
+     from = nw(1, n2, n1);
+     to = nw(2, n3, n2);
+     a = TurnRestrictionBuilder.intersectionAngle(from, to);
+     assertEquals(-45, Math.toDegrees(a), 1e-7);
+ }
+
+
+     /*
+     *
+     *      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(Arrays.asList(n11, n22));
+        Way w21 = new Way(21);
+        w21.setNodes(Arrays.asList(n21, n22));
+        Way w22 = new Way(22);
+        w22.setNodes(Arrays.asList(n22, n23));
+
+        Way adjustedTo = selectToWayAfterSplit(
+            w1,
+            w21,
+            w22,
+            TurnRestrictionType.NO_LEFT_TURN
+        );
+
+        assertNotNull(adjustedTo);
+        assertEquals(w21, adjustedTo);
+
+        adjustedTo = selectToWayAfterSplit(
+            w1,
+            w21,
+            w22,
+            TurnRestrictionType.NO_RIGHT_TURN
+        );
+
+        assertNotNull(adjustedTo);
+        assertEquals(w22, adjustedTo);
+
+        adjustedTo = selectToWayAfterSplit(
+            w1,
+            w21,
+            w22,
+            TurnRestrictionType.ONLY_LEFT_TURN
+        );
+
+        assertNotNull(adjustedTo);
+        assertEquals(w21, adjustedTo);
+
+        adjustedTo = selectToWayAfterSplit(
+            w1,
+            w21,
+            w22,
+            TurnRestrictionType.ONLY_RIGHT_TURN
+        );
+
+        assertNotNull(adjustedTo);
+        assertEquals(w22, adjustedTo);
+
+        adjustedTo = selectToWayAfterSplit(
+            w1,
+            w21,
+            w22,
+            TurnRestrictionType.NO_STRAIGHT_ON
+        );
+
+        assertNull(adjustedTo);
+    }
+}
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 32924)
+++ 	(revision )
@@ -1,70 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions.editor;
-
-import static org.junit.Assert.*
-
-import org.junit.*
-
-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/ExceptValueModelTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModelTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModelTest.java	(revision 32925)
@@ -0,0 +1,72 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class ExceptValueModelTest {
+
+    @Test
+    public void testConstructors() {
+        new ExceptValueModel();
+        new ExceptValueModel(null);
+        new ExceptValueModel("");
+        new ExceptValueModel("  ");
+        new ExceptValueModel("hgv");
+        new ExceptValueModel("hgv;psv");
+        new ExceptValueModel("non_standard");
+    }
+
+    @Test
+    public void testSetValue() {
+        ExceptValueModel evm;
+
+        // null value allowed - means no vehicle exceptions
+        evm = new ExceptValueModel();
+        evm.setValue(null);
+        assertEquals("", evm.getValue());
+        assertTrue(evm.isStandard());
+
+        // empty string allowed - means no vehicle expections
+        evm = new ExceptValueModel();
+        evm.setValue("");
+        assertEquals("", evm.getValue());
+        assertTrue(evm.isStandard());
+
+        // a single standard vehicle exeption
+        evm = new ExceptValueModel();
+        evm.setValue("hgv");
+        assertEquals("hgv", evm.getValue());
+        assertTrue(evm.isVehicleException("hgv"));
+        assertFalse(evm.isVehicleException("psv"));
+        assertTrue(evm.isStandard());
+
+        // two standard vehicle exceptions
+        evm = new ExceptValueModel();
+        evm.setValue("hgv;psv");
+        assertEquals("hgv;psv", evm.getValue());
+        assertTrue(evm.isVehicleException("hgv"));
+        assertTrue(evm.isVehicleException("psv"));
+        assertTrue(evm.isStandard());
+
+        // white space and lowercase/uppercase mix allowed. Should be normalized
+        // by the except value model
+        evm = new ExceptValueModel();
+        evm.setValue(" hGv ; PsV  ");
+        assertEquals("hgv;psv", evm.getValue());
+        assertTrue(evm.isVehicleException("hgv"));
+        assertTrue(evm.isVehicleException("psv"));
+        assertTrue(evm.isStandard());
+
+        // non standard value allowed
+        evm = new ExceptValueModel();
+        evm.setValue("Non Standard");
+        assertEquals("Non Standard", evm.getValue());
+        assertFalse(evm.isVehicleException("hgv"));
+        assertFalse(evm.isVehicleException("psv"));
+        assertFalse(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 32924)
+++ 	(revision )
@@ -1,160 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions.editor;
-
-import static groovy.test.GroovyAssert.shouldFail
-import static org.junit.Assert.*
-
-import javax.swing.DefaultListSelectionModel
-
-import org.junit.*
-import org.openstreetmap.josm.Main
-import org.openstreetmap.josm.data.coor.*
-import org.openstreetmap.josm.data.osm.*
-import org.openstreetmap.josm.gui.layer.OsmDataLayer
-import org.openstreetmap.josm.testutils.JOSMTestRules
-
-/**
- * Unit test for {@see JosmSelctionListModel}
- */
-class JosmSelectionListModelTest {
-
-    @Rule
-    public JOSMTestRules rules = new JOSMTestRules().preferences();
-
-    @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)
-
-        Main.getLayerManager().addLayer(layer1)
-        Main.getLayerManager().addLayer(layer2)
-
-        JosmSelectionListModel model = new JosmSelectionListModel(layer1);
-        Main.getLayerManager().addActiveLayerChangeListener(model)
-        DefaultListSelectionModel selectionModel = model.getListSelectionModel()
-        // switch from edit layer1 to edit layer2. content of the JOSM selection
-        // should be empty thereafter
-        Main.getLayerManager().setActiveLayer(layer1)
-        Main.getLayerManager().setActiveLayer(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]])
-        Main.getLayerManager().setActiveLayer(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
-        Main.getLayerManager().removeLayer(layer2)
-        Main.getLayerManager().removeLayer(layer1)
-        assert model.getSize() == 0
-
-        Main.getLayerManager().removeActiveLayerChangeListener(model)
-    }
-}
Index: applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.java	(revision 32925)
@@ -0,0 +1,165 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.swing.ListSelectionModel;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.Main;
+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.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+/**
+ * Unit test for {@see JosmSelctionListModel}
+ */
+public class JosmSelectionListModelTest {
+
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences();
+
+    @Test
+    public void testConstructor() {
+        assertNotNull(new JosmSelectionListModel(new OsmDataLayer(new DataSet(), "test", null)));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testConstructorNull() {
+        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
+        model.setJOSMSelection(Arrays.asList(new Node(new LatLon(1, 1)), new Way(), new Relation()));
+        assertEquals(3, model.getSize());
+
+        // null is allowed
+        model.setJOSMSelection(null);
+        assertEquals(0, model.getSize());
+        assertTrue(model.getSelected().isEmpty());
+
+        // empty has the same effect
+        model.setJOSMSelection(new ArrayList<>());
+        assertEquals(0, model.getSize());
+        assertTrue(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);
+        List<OsmPrimitive> objects = (Arrays.asList(new Node(new LatLon(1, 1)), new Way(), new Relation()));
+        model.setJOSMSelection(objects);
+        model.setSelected(objects.subList(0, 1));
+        assertEquals(new HashSet<>(objects.subList(0, 1)), model.getSelected());
+
+        // 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.subList(1, 2);
+        model.setJOSMSelection(objects);
+        assertEquals(Collections.singleton(objects.get(0)), model.getSelected());
+    }
+
+    @Test
+    public void test_getSelected() {
+        DataSet ds = new DataSet();
+        OsmDataLayer layer = new OsmDataLayer(ds, "test", null);
+
+        JosmSelectionListModel model = new JosmSelectionListModel(layer);
+        ListSelectionModel selectionModel = model.getListSelectionModel();
+
+        assertNotNull(model.getSelected());
+        assertTrue(model.getSelected().isEmpty());
+
+        // select one element
+        model.setJOSMSelection(Arrays.asList(new Node(new LatLon(1, 1)), new Way(), new Relation()));
+        selectionModel.setSelectionInterval(0, 0);
+        assertEquals(Collections.singleton(model.getElementAt(0)), model.getSelected());
+
+        // select two elements
+        selectionModel.setSelectionInterval(1, 2);
+        assertEquals(new HashSet<>(Arrays.asList(model.getElementAt(1), model.getElementAt(2))), model.getSelected());
+    }
+
+    @Test
+    public void test_setSelected() {
+        // set selected with null is OK - nothing selected thereafter
+        JosmSelectionListModel model = new JosmSelectionListModel(new OsmDataLayer(new DataSet(), "test", null));
+        model.setSelected(null);
+        assertTrue(model.getSelected().isEmpty());
+
+        // set selected with empty list is OK - nothing selected thereafter
+        model.setSelected(new ArrayList<>());
+        assertTrue(model.getSelected().isEmpty());
+
+        // select an object existing in the list of displayed objects
+        List<OsmPrimitive> objects = (Arrays.asList(new Node(new LatLon(1, 1)), new Way(), new Relation()));
+        model.setJOSMSelection(objects);
+        model.setSelected(Arrays.asList(objects.get(0)));
+        assertEquals(Collections.singleton(objects.get(0)), model.getSelected());
+
+        // select an object not-existing in the list of displayed objects
+        model.setJOSMSelection(objects);
+        model.setSelected(Arrays.asList(new Way()));
+        assertTrue(model.getSelected().isEmpty());
+    }
+
+    @Test
+    public void test_editLayerChanged() {
+        DataSet ds = new DataSet();
+
+        List<OsmPrimitive> objects = (Arrays.asList(new Node(new LatLon(1, 1)), new Way(), new Relation()));
+        objects.stream().forEach(ds::addPrimitive);
+
+        OsmDataLayer layer1 = new OsmDataLayer(ds, "layer1", null);
+        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "layer2", null);
+
+        Main.getLayerManager().addLayer(layer1);
+        Main.getLayerManager().addLayer(layer2);
+
+        JosmSelectionListModel model = new JosmSelectionListModel(layer1);
+        Main.getLayerManager().addActiveLayerChangeListener(model);
+        // switch from edit layer1 to edit layer2. content of the JOSM selection
+        // should be empty thereafter
+        Main.getLayerManager().setActiveLayer(layer1);
+        Main.getLayerManager().setActiveLayer(layer2);
+        assertEquals(0, model.getSize());
+
+        // switch from layer2 to layer1 which has one object selected. Object should
+        // be displayed in the JOSM selection list
+        ds.setSelected(Collections.singleton(objects.get(0)));
+        Main.getLayerManager().setActiveLayer(layer1);
+        assertEquals(1, model.getSize());
+        assertEquals(objects.get(0), model.getElementAt(0));
+
+        // switch to a "null" edit layer (i.e. no edit layer)- nothing should
+        // be displayed in the selection list
+        Main.getLayerManager().removeLayer(layer2);
+        Main.getLayerManager().removeLayer(layer1);
+        assertEquals(0, model.getSize());
+
+        Main.getLayerManager().removeActiveLayerChangeListener(model);
+    }
+}
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 32924)
+++ 	(revision )
@@ -1,272 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions.editor;
-import static groovy.test.GroovyAssert.shouldFail
-import static org.junit.Assert.*
-import static org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionLegRole.*
-
-import org.junit.*
-import org.openstreetmap.josm.data.coor.*
-import org.openstreetmap.josm.data.osm.*
-import org.openstreetmap.josm.gui.layer.OsmDataLayer
-import org.openstreetmap.josm.testutils.JOSMTestRules
-
-/**
- * This is a unit test for {@link TurnRestrictionEditorModel}
- */
-class TurnRestrictionEditorModelUnitTest {
-
-    @Rule
-    public JOSMTestRules rules = new JOSMTestRules().preferences();
-
-    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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModelUnitTest.java	(revision 32925)
@@ -0,0 +1,316 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionLegRole.FROM;
+import static org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionLegRole.TO;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+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.OsmPrimitiveType;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+/**
+ * This is a unit test for {@link TurnRestrictionEditorModel}
+ */
+public class TurnRestrictionEditorModelUnitTest {
+
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences();
+
+    private final NavigationControler navigationControlerMock = new NavigationControler() {
+        @Override
+        public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+        }
+
+        @Override
+        public void gotoBasicEditor() {
+        }
+
+        @Override
+        public void gotoAdvancedEditor() {
+        }
+    };
+
+    private DataSet ds;
+    private OsmDataLayer layer;
+    private TurnRestrictionEditorModel model;
+
+    Node createNode(Long id, LatLon coor) {
+        Node n;
+        if (id == null) {
+            n = new Node();
+        } else {
+            n = new Node(id);
+        }
+        if (coor != null)
+            n.setCoor(coor);
+        ds.addPrimitive(n);
+        return n;
+    }
+
+    Way createWay(Long id) {
+        Way w;
+        if (id == null) {
+            w = new Way();
+        } else {
+            w = new Way(id);
+        }
+        ds.addPrimitive(w);
+        return w;
+    }
+
+    Node node(long id) {
+        return (Node) ds.getPrimitiveById(new SimplePrimitiveId(id, OsmPrimitiveType.NODE));
+    }
+
+    Way way(long id) {
+        return (Way) ds.getPrimitiveById(new SimplePrimitiveId(id, OsmPrimitiveType.WAY));
+    }
+
+    Relation rel(long id) {
+        return (Relation) ds.getPrimitiveById(new SimplePrimitiveId(id, OsmPrimitiveType.RELATION));
+    }
+
+    RelationMember rm(String role, OsmPrimitive object) {
+        return new RelationMember(role, object);
+    }
+
+    void buildDataSet1() {
+        // prepare some nodes and ways
+        createNode(21L, null);
+        createNode(22L, null);
+        createNode(31L, null);
+        createNode(32L, null);
+        createWay(2L);
+        createWay(3L);
+
+        way(2).setNodes(Arrays.asList(node(21), node(22)));
+        way(3).setNodes(Arrays.asList(node(22), node(31)));
+
+        // a standard turn restriction with a from, a to and a via
+        Relation r = new Relation(1);
+        r.setMembers(Arrays.asList(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(expected = IllegalArgumentException.class)
+    public void testConstructor1() {
+        new TurnRestrictionEditorModel(null, navigationControlerMock);
+    }
+
+    /**
+     * Test the constructor
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testConstructor2() {
+        new TurnRestrictionEditorModel(layer, null);
+    }
+
+    @Test
+    public void testPopulateEmptyTurnRestriction() {
+        // an "empty" turn restriction with a public id
+        Relation r = new Relation(1);
+        ds.addPrimitive(r);
+        assertTrue(model.getTurnRestrictionLeg(FROM).isEmpty());
+        assertTrue(model.getTurnRestrictionLeg(TO).isEmpty());
+        assertTrue(model.getVias().isEmpty());
+        assertEquals("", model.getRestrictionTagValue());
+        assertEquals("", 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));
+
+        assertEquals(Collections.singleton(way(2)), model.getTurnRestrictionLeg(FROM));
+        assertEquals(Collections.singleton(way(3)), model.getTurnRestrictionLeg(TO));
+        assertEquals(Arrays.asList(node(22)), model.getVias());
+        assertEquals("no_left_turn", model.getRestrictionTagValue());
+        assertEquals("", model.getExcept().getValue());
+    }
+
+    @Test
+    public void setFrom() {
+        buildDataSet1();
+        model.populate(rel(1));
+
+        createNode(41L, null);
+        createNode(42L, null);
+        createWay(4L).setNodes(Arrays.asList(node(41), node(42)));
+
+        // set another way as from
+        model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, way(4).getPrimitiveId());
+        assertEquals(Collections.singleton(way(4)), model.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM));
+
+        // delete the/all members with role 'from'
+        model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, null);
+        assertTrue(model.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM).isEmpty());
+
+        try {
+            // can't add a node as 'from'
+            model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, node(21).getPrimitiveId());
+            fail();
+        } catch (IllegalArgumentException e) {
+            // OK
+            System.out.println(e.getMessage());
+        }
+
+        try {
+            // can't set a way as 'from' if it isn't part of the dataset
+            model.setTurnRestrictionLeg(TurnRestrictionLegRole.FROM, new Way().getPrimitiveId());
+            fail();
+        } catch (IllegalStateException e) {
+            // OK
+            System.out.println(e.getMessage());
+        }
+    }
+
+    @Test
+    public void setTo() {
+        buildDataSet1();
+        model.populate(rel(1));
+
+        createNode(41L, null);
+        createNode(42L, null);
+        createWay(4L).setNodes(Arrays.asList(node(41), node(42)));
+
+        // set another way as from
+        model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, way(4).getPrimitiveId());
+        assertEquals(Collections.singleton(way(4)), model.getTurnRestrictionLeg(TurnRestrictionLegRole.TO));
+
+        // delete the/all members with role 'from'
+        model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, null);
+        assertTrue(model.getTurnRestrictionLeg(TurnRestrictionLegRole.TO).isEmpty());
+
+        try {
+            // can't add a node as 'from'
+            model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, node(21).getPrimitiveId());
+            fail();
+        } catch (IllegalArgumentException e) {
+            // OK
+            System.out.println(e.getMessage());
+        }
+
+        try {
+            // can't set a way as 'from' if it isn't part of the dataset
+            model.setTurnRestrictionLeg(TurnRestrictionLegRole.TO, new Way().getPrimitiveId());
+            fail();
+        } catch (IllegalStateException e) {
+            // OK
+            System.out.println(e.getMessage());
+        }
+    }
+
+    /**
+     * Test setting or deleting the tag 'restriction'
+     */
+    @Test
+    public void setRestrictionTagValue() {
+        buildDataSet1();
+        model.populate(rel(1));
+
+        model.setRestrictionTagValue("no_left_turn");
+        assertEquals("no_left_turn", model.getRestrictionTagValue());
+
+        model.setRestrictionTagValue(null);
+        assertEquals("", model.getRestrictionTagValue());
+
+        model.setRestrictionTagValue("  ");
+        assertEquals("", model.getRestrictionTagValue());
+
+        model.setRestrictionTagValue(" no_right_Turn ");
+        assertEquals("no_right_turn", model.getRestrictionTagValue());
+    }
+
+    /**
+     * Test setting vias
+     */
+    @Test
+    public void setVias() {
+        buildDataSet1();
+        model.populate(rel(1));
+
+        // one node as via - OK
+        model.setVias(Arrays.asList(node(22)));
+        assertEquals(Arrays.asList(node(22)), model.getVias());
+
+        // pass in null as vias -> remove all vias
+        model.setVias(null);
+        assertTrue(model.getVias().isEmpty());
+
+        // pass in empty list -> remove all vias
+        model.setVias(new ArrayList<>());
+        assertTrue(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(41L, null);
+        createNode(42L, null);
+        createWay(4L).setNodes(Arrays.asList(node(41), node(42)));
+        model.setVias(Arrays.asList(way(4), node(22), node(22)));
+        assertEquals(Arrays.asList(way(4), node(22), node(22)), model.getVias());
+
+        // null values in the list of vias are skipped
+        model.setVias(Arrays.asList(null, node(22)));
+        assertEquals(Arrays.asList(node(22)), model.getVias());
+
+        try {
+            // an object which doesn't belong to the same dataset can't be a via
+            model.setVias(Arrays.asList(new Node(LatLon.ZERO)));
+            fail();
+        } catch (IllegalArgumentException e) {
+            // OK
+            System.out.println(e.getMessage());
+        }
+    }
+
+    /**
+     * Tests whether the three sub models exist
+     */
+    @Test
+    public void submodelsExist() {
+        assertNotNull(model.getIssuesModel());
+        assertNotNull(model.getRelationMemberEditorModel());
+        assertNotNull(model.getTagEditorModel());
+
+        assertEquals(layer, model.getLayer());
+    }
+}
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 32924)
+++ 	(revision )
@@ -1,51 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions.editor;
-
-import static groovy.test.GroovyAssert.shouldFail
-import static org.junit.Assert.*
-
-import org.junit.*
-import org.openstreetmap.josm.data.osm.DataSet
-import org.openstreetmap.josm.gui.layer.OsmDataLayer
-import org.openstreetmap.josm.testutils.JOSMTestRules
-
-/**
- * Unit test for the {@link TurnRestrictionLegEditor}
- */
-class TurnRestrictionLegEditorUnitTest  {
-
-    @Rule
-    public JOSMTestRules rules = new JOSMTestRules().preferences();
-
-    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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditorUnitTest.java	(revision 32925)
@@ -0,0 +1,60 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+/**
+ * Unit test for the {@link TurnRestrictionLegEditor}
+ */
+public class TurnRestrictionLegEditorUnitTest {
+
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences();
+
+    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, new NavigationControler() {
+            @Override
+            public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+            }
+
+            @Override
+            public void gotoBasicEditor() {
+            }
+
+            @Override
+            public void gotoAdvancedEditor() {
+            }
+        });
+    }
+
+    @Test
+    public void testConstructor1() {
+        TurnRestrictionLegEditor editor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.FROM);
+        assertEquals(model, editor.getModel());
+        assertEquals(TurnRestrictionLegRole.FROM, editor.getRole());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testConstructor2() {
+        new TurnRestrictionLegEditor(null, TurnRestrictionLegRole.FROM);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testConstructor3() {
+        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 32924)
+++ 	(revision )
@@ -1,37 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions.editor;
-
-import static org.junit.Assert.*
-
-import org.junit.*
-import org.openstreetmap.josm.testutils.JOSMTestRules
-
-class TurnRestrictionTypeRendererTest {
-
-    @Rule
-    public JOSMTestRules rules = new JOSMTestRules().preferences();
-
-    @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/TurnRestrictionTypeRendererTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRendererTest.java	(revision 32925)
@@ -0,0 +1,43 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import javax.swing.JLabel;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+public class TurnRestrictionTypeRendererTest {
+
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences();
+
+    @Test
+    public void test_Constructor() {
+        TurnRestrictionTypeRenderer renderer = new TurnRestrictionTypeRenderer();
+
+        assertNotNull(renderer.icons);
+        assertNotNull(renderer.icons.get(TurnRestrictionType.NO_LEFT_TURN));
+    }
+
+    @Test
+    public void test_getListCellRendererComponent_1() {
+        TurnRestrictionTypeRenderer renderer = new TurnRestrictionTypeRenderer();
+
+        JLabel c = (JLabel) renderer.getListCellRendererComponent(null, null, 0, false, false);
+        assertNull(c.getIcon());
+        assertNotNull(c.getText());
+
+        c = (JLabel) renderer.getListCellRendererComponent(null, "non-standard-value", 0, false, false);
+        assertNull(c.getIcon());
+        assertEquals("non-standard-value", c.getText());
+
+        c = (JLabel) renderer.getListCellRendererComponent(null, TurnRestrictionType.NO_LEFT_TURN, 0, false, false);
+        assertEquals(renderer.icons.get(TurnRestrictionType.NO_LEFT_TURN), c.getIcon());
+        assertEquals(TurnRestrictionType.NO_LEFT_TURN.getDisplayName(), c.getText());
+    }
+}
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 32924)
+++ 	(revision )
@@ -1,20 +1,0 @@
-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/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.java	(revision 32925)
+++ applications/editors/josm/plugins/turnrestrictions/test/unit/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeTest.java	(revision 32925)
@@ -0,0 +1,23 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class TurnRestrictionTypeTest {
+
+    @Test
+    public void test_fromTagValue() {
+
+        TurnRestrictionType type = TurnRestrictionType.fromTagValue("no_left_turn");
+        assertEquals(TurnRestrictionType.NO_LEFT_TURN, type);
+
+        type = TurnRestrictionType.fromTagValue("doesnt_exist");
+        assertNull(type);
+
+        type = TurnRestrictionType.fromTagValue(null);
+        assertNull(type);
+    }
+}
