@Test
    public void touchPolyline() {

       //directly on line
        assertThat(polyline(GP_1, 0, 0, 10).touches(GP_1, TO_LATLON_E6)).isTrue();
        assertThat(polyline(GP_1, 0, 0, 10).touches(addE6(GP_1, 0, 10), TO_LATLON_E6)).isTrue();

        //within "half linewidth" distance of line
        final int minLineWidth  = GeoItemUtils.getMinPixelTouchWidth();
        assertThat(polyline(GP_1, 0, 0, 10).touches(addE6(GP_1, minLineWidth / 2, 10), TO_LATLON_E6)).isTrue();
        assertThat(polyline(GP_1, 0, 0, 10).touches(addE6(GP_1, minLineWidth / 2 + 10, 10), TO_LATLON_E6)).isFalse();
    }
A fake bitmap provider used for testing touching routines
main/src/test/java/cgeo/geocaching/models/geoitem/GeoItemTest.java