package cgeo.geocaching.connector.gc;

import static org.assertj.core.api.Java6Assertions.assertThat;

import cgeo.CGeoTestCase;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.models.Geocache;
import cgeo.geocaching.storage.DataStore;

public class WaypointsTest extends CGeoTestCase {

    private static Geocache downloadCache(final String geocode) {
        final SearchResult searchResult = Geocache.searchByGeocode(geocode, null, true, null);
        assertThat(searchResult.getCount()).isEqualTo(1);
        return searchResult.getFirstCacheFromResult(LoadFlags.LOAD_WAYPOINTS);
    }

    public static void testDownloadWaypoints() {
        // Check that repeated loads of "GC33HXE" hold the right number of waypoints (issue #2430).
        final String geocode = "GC33HXE";
        DataStore.removeCache(geocode, LoadFlags.REMOVE_ALL);
        assertThat(downloadCache(geocode).getWaypoints()).hasSize(9);
        assertThat(downloadCache(geocode).getWaypoints()).hasSize(9);
    }

}

@@ -734,25 +734,24 @@
 oads of 
-%22GC33HXE%22
+geocache
  hold th
@@ -832,12 +832,12 @@
 %22GC3
-3HXE
+KE70
 %22;%0A 
@@ -959,25 +959,26 @@
 ()).hasSize(
-9
+15
 );%0A        a
@@ -1038,9 +1038,10 @@
 ize(
-9
+15
 );%0A 

fix #7044 WaypointsTest