Index: applications/viewer/jmapviewer/.classpath
===================================================================
--- applications/viewer/jmapviewer/.classpath	(revision 34621)
+++ applications/viewer/jmapviewer/.classpath	(revision 34669)
@@ -2,5 +2,11 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" output="bintest" path="test">
+		<attributes>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
 	<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 kind="output" path="bin"/>
 </classpath>
Index: applications/viewer/jmapviewer/build.xml
===================================================================
--- applications/viewer/jmapviewer/build.xml	(revision 34621)
+++ applications/viewer/jmapviewer/build.xml	(revision 34669)
@@ -1,34 +1,65 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project default="all" name="jmapviewer" xmlns:if="ant:if" xmlns:unless="ant:unless">
+<project default="all" name="jmapviewer" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
 
-	<property name="java.lang.version" value="1.8" />
-	<!-- For Java9-specific stuff -->
-	<condition property="isJava9">
-		<matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" />
-	</condition>
+    <property name="java.lang.version" value="1.8" />
+    <dirname property="base.dir" file="${ant.file.jmapviewer}"/>
+    <property name="tools.dir" location="${base.dir}/tools"/>
+    <property name="jacoco.includes" value="org.openstreetmap.gui.jmapviewer.*" />
+    <property name="jacoco.inclbootstrapclasses" value="false" />
+    <property name="jacoco.inclnolocationclasses" value="false" />
+    <!-- For Java specific stuff by version -->
+    <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
+    <condition property="isJava10"><matches string="${ant.java.version}" pattern="1[0-9]" /></condition>
+    <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]" /></condition>
+    <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]" /></condition>
+    <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]" /></condition>
+    <!-- Disable jacoco on Java 13+, see https://github.com/jacoco/jacoco/pull/738 -->
+    <condition property="coverageByDefault">
+        <not>
+            <isset property="isJava13"/>
+        </not>
+    </condition>
+    <path id="test.classpath">
+        <fileset dir="${tools.dir}/testlib">
+            <include name="**/*.jar"/>
+        </fileset>
+        <pathelement location="bin"/>
+    </path>
 
-	<target name="all" depends="clean,build,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
+    <target name="all" depends="clean,build,test,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
 
-	<target name="clean">
-		<mkdir dir="bin" />
-		<delete>
-			<fileset dir="bin">
-				<include name="**" />
-			</fileset>
-			<fileset dir="." includes="*.jar"/>
-		</delete>
-	</target>
+    <target name="clean">
+        <mkdir dir="bin" />
+        <mkdir dir="bintest" />
+        <mkdir dir="javadoc" />
+        <mkdir dir="report" />
+        <delete>
+            <fileset dir="bin">
+                <include name="**" />
+            </fileset>
+            <fileset dir="bintest">
+                <include name="**" />
+            </fileset>
+            <fileset dir="javadoc">
+                <include name="**" />
+            </fileset>
+            <fileset dir="report">
+                <include name="**" />
+            </fileset>
+            <fileset dir="." includes="*.jar,*.exec"/>
+        </delete>
+    </target>
 
-	<target name="build">
-		<javac srcdir="src" destdir="bin" source="${java.lang.version}" target="${java.lang.version}" debug="true" includeantruntime="false" encoding="UTF-8">
-			<include name="org/openstreetmap/gui/jmapviewer/**" />
-		</javac>
+    <target name="build" depends="clean">
+        <javac srcdir="src" destdir="bin" source="${java.lang.version}" target="${java.lang.version}" debug="true" includeantruntime="false" encoding="UTF-8">
+            <include name="org/openstreetmap/gui/jmapviewer/**" />
+        </javac>
 
-		<copy todir="bin">
-			<fileset dir="src">
-				<include name="**/*.png" />
-			</fileset>
-		</copy>
-	</target>
+        <copy todir="bin">
+            <fileset dir="src">
+                <include name="**/*.png" />
+            </fileset>
+        </copy>
+    </target>
 
     <target name="svn_info" description="Get SVN info for use in JAR/ZIP filenames.">
@@ -39,50 +70,50 @@
         </exec>
     </target>
-	
-	<target name="pack" depends="build">
-		<!-- Create the JAR file containing the compiled class files -->
-		<jar destfile="JMapViewer.jar" filesetmanifest="mergewithoutmain">
-			<fileset dir="bin" includes="**/jmapviewer/**" />
-		</jar>
-		<!-- Create the JAR file containing the source java files -->
-		<jar destfile="JMapViewer_src.jar" filesetmanifest="mergewithoutmain">
-			<fileset dir="src" includes="**/jmapviewer/**" />
-		</jar>
-	</target>
-	
-	<!-- if you want to build outside of svn, use "ant clean build [pack]" -->
-	
-	<target name="create_run_jar" description="Create a JAR file that can be used to execute the JMapViewer demo app. Requires JMapViewer.jar to be present.">
-		<jar destfile="JMapViewer_Demo.jar" filesetmanifest="mergewithoutmain">
-			<manifest>
-				<attribute name="Main-Class" value="org.openstreetmap.gui.jmapviewer.Demo" />
-				<attribute name="Class-Path" value="JMapViewer.jar" />
-			</manifest>
-		</jar>
-	</target>
+    
+    <target name="pack" depends="build">
+        <!-- Create the JAR file containing the compiled class files -->
+        <jar destfile="JMapViewer.jar" filesetmanifest="mergewithoutmain">
+            <fileset dir="bin" includes="**/jmapviewer/**" />
+        </jar>
+        <!-- Create the JAR file containing the source java files -->
+        <jar destfile="JMapViewer_src.jar" filesetmanifest="mergewithoutmain">
+            <fileset dir="src" includes="**/jmapviewer/**" />
+        </jar>
+    </target>
+    
+    <!-- if you want to build outside of svn, use "ant clean build [pack]" -->
+    
+    <target name="create_run_jar" description="Create a JAR file that can be used to execute the JMapViewer demo app. Requires JMapViewer.jar to be present.">
+        <jar destfile="JMapViewer_Demo.jar" filesetmanifest="mergewithoutmain">
+            <manifest>
+                <attribute name="Main-Class" value="org.openstreetmap.gui.jmapviewer.Demo" />
+                <attribute name="Class-Path" value="JMapViewer.jar" />
+            </manifest>
+        </jar>
+    </target>
 
-	<target name="create_release_zip" description="Create a release zip file containing the binary and source jar files as well as the demo starter">
-		<zip basedir="." destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}.zip">
-			<include name="JMapViewer*.jar" />
-			<include name="Readme.txt" />
-			<include name="Gpl.txt" />
-		</zip>
-		<delete>
-			<fileset dir="." includes="JMapViewer*.jar"/>
-		</delete> 
-	</target>
-	
-	<target name="create_source_release_zip" description="Create a release zip file containing the source files">
-		<zip destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}-Source.zip">
-			<zipfileset file="Readme.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
-			<zipfileset file="build.xml" prefix="jmapviewer-${svnReleaseVersion}"/>
-			<zipfileset file="Gpl.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
-			<zipfileset dir="src" includes="**/jmapviewer/**" prefix="jmapviewer-${svnReleaseVersion}/src"/>
-		</zip>
-	</target>
+    <target name="create_release_zip" description="Create a release zip file containing the binary and source jar files as well as the demo starter">
+        <zip basedir="." destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}.zip">
+            <include name="JMapViewer*.jar" />
+            <include name="Readme.txt" />
+            <include name="Gpl.txt" />
+        </zip>
+        <delete>
+            <fileset dir="." includes="JMapViewer*.jar"/>
+        </delete> 
+    </target>
+    
+    <target name="create_source_release_zip" description="Create a release zip file containing the source files">
+        <zip destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}-Source.zip">
+            <zipfileset file="Readme.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
+            <zipfileset file="build.xml" prefix="jmapviewer-${svnReleaseVersion}"/>
+            <zipfileset file="Gpl.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
+            <zipfileset dir="src" includes="**/jmapviewer/**" prefix="jmapviewer-${svnReleaseVersion}/src"/>
+        </zip>
+    </target>
 
     <target name="checkstyle">
         <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" 
-        	classpath="tools/checkstyle/checkstyle-all.jar"/>
+            classpath="tools/checkstyle/checkstyle-all.jar"/>
         <checkstyle config="tools/checkstyle/jmapviewer_checks.xml">
             <fileset dir="${basedir}/src" includes="**/*.java" />
@@ -93,5 +124,5 @@
     <target name="spotbugs" depends="pack">
         <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" 
-        	classpath="tools/spotbugs/spotbugs-ant.jar"/>
+            classpath="tools/spotbugs/spotbugs-ant.jar"/>
         <path id="spotbugs-classpath">
             <fileset dir="tools/spotbugs/">
@@ -110,5 +141,5 @@
     </target>
 
-	<target name="javadoc">
+    <target name="javadoc">
         <javadoc destdir="javadoc" 
                 sourcepath="src"
@@ -127,3 +158,31 @@
     </target>
 
+    <target name="test" depends="clean, build">
+        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
+        <javac srcdir="test" destdir="bintest"
+            target="${java.lang.version}" source="${java.lang.version}" debug="on"
+            includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
+            <compilerarg value="-Xlint:all"/>
+            <compilerarg value="-Xlint:-serial"/>
+            <classpath>
+            	<path refid="test.classpath"/>
+            </classpath>
+        </javac>
+        <jacoco:coverage enabled="@{coverage}" includes="${jacoco.includes}"
+            inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
+            <junit printsummary="yes" fork="true" forkmode="once">
+                <jvmarg value="-Dfile.encoding=UTF-8"/>
+                <classpath>
+                    <path refid="test.classpath"/>
+                    <pathelement location="bintest"/>
+                </classpath>
+                <formatter type="plain"/>
+                <formatter type="xml"/>
+                <batchtest fork="yes" todir="report">
+                    <fileset dir="bintest" includes="**/*Test.class"/>
+                </batchtest>
+            </junit>
+        </jacoco:coverage>
+    </target>
+
 </project>
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java	(revision 34621)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java	(revision 34669)
@@ -83,5 +83,4 @@
     /**
      * @return default tile size, for this tile source
-     * TODO: @since
      */
     int getDefaultTileSize();
Index: applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/TileRangeTest.java
===================================================================
--- applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/TileRangeTest.java	(revision 34669)
+++ applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/TileRangeTest.java	(revision 34669)
@@ -0,0 +1,22 @@
+// License: GPL. For details, see Readme.txt file.
+package org.openstreetmap.gui.jmapviewer;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link TileRange} class.
+ */
+public class TileRangeTest {
+
+    /**
+     * Unit test of {@link TileRange#size}.
+     */
+    @Test
+    public void testSize() {
+        assertEquals(16, new TileRange(
+                new TileXY(3, 3), 
+                new TileXY(6, 6), 10).size());
+    }
+}
