aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/Geocache.java69
-rw-r--r--main/src/cgeo/geocaching/ICache.java164
-rw-r--r--main/src/cgeo/geocaching/connector/ConnectorFactory.java4
-rw-r--r--main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/GeopeitusConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/IConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/UnknownConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/WaymarkingConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/ec/ECConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCConnector.java3
-rw-r--r--main/src/cgeo/geocaching/connector/ox/OXConnector.java3
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java4
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java3
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC2CJPF.java3
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC2JVEH.java3
-rw-r--r--tests/src/cgeo/geocaching/test/mock/GC3XX5J.java3
-rw-r--r--tests/src/cgeo/geocaching/test/mock/MockedCache.java10
-rw-r--r--tests/src/cgeo/test/Compare.java3
20 files changed, 61 insertions, 235 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index 54ddf5e..6c8e1b8 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -76,9 +76,9 @@ import java.util.Set;
import java.util.regex.Pattern;
/**
- * Internal c:geo representation of a "cache"
+ * Internal representation of a "cache"
*/
-public class Geocache implements ICache, IWaypoint {
+public class Geocache implements IWaypoint, ILogable, ICoordinates {
private static final int OWN_WP_PREFIX_OFFSET = 17;
private long updated = 0;
@@ -170,7 +170,7 @@ public class Geocache implements ICache, IWaypoint {
* Cache constructor to be used by the GPX parser only. This constructor explicitly sets several members to empty
* lists.
*
- * @param gpxParser
+ * @param gpxParser ignored parameter allowing to select this constructor
*/
public Geocache(final GPXParser gpxParser) {
setReliableLatLon(true);
@@ -543,7 +543,6 @@ public class Geocache implements ICache, IWaypoint {
return getConnector().getLoggingManager(activity, this);
}
- @Override
public float getDifficulty() {
return difficulty;
}
@@ -553,12 +552,13 @@ public class Geocache implements ICache, IWaypoint {
return geocode;
}
- @Override
+ /**
+ * @return displayed owner, might differ from the real owner
+ */
public String getOwnerDisplayName() {
return ownerDisplayName;
}
- @Override
public CacheSize getSize() {
if (size == null) {
return CacheSize.UNKNOWN;
@@ -566,22 +566,18 @@ public class Geocache implements ICache, IWaypoint {
return size;
}
- @Override
public float getTerrain() {
return terrain;
}
- @Override
public boolean isArchived() {
return BooleanUtils.isTrue(archived);
}
- @Override
public boolean isDisabled() {
return BooleanUtils.isTrue(disabled);
}
- @Override
public boolean isPremiumMembersOnly() {
return BooleanUtils.isTrue(premiumMembersOnly);
}
@@ -590,20 +586,26 @@ public class Geocache implements ICache, IWaypoint {
this.premiumMembersOnly = members;
}
- @Override
+ /**
+ *
+ * @return {@code true} if the user is the owner of the cache, {@code false} otherwise
+ */
public boolean isOwner() {
return getConnector().isOwner(this);
}
- @Override
- public String getOwnerUserId() {
+ /**
+ * @return GC username of the (actual) owner, might differ from the owner. Never empty.
+ */
+ @NonNull public String getOwnerUserId() {
return ownerUserId;
}
/**
* Attention, calling this method may trigger a database access for the cache!
+ *
+ * @return the decrypted hint
*/
- @Override
public String getHint() {
initializeCacheTexts();
assertTextNotNull(hint, "Hint");
@@ -623,7 +625,6 @@ public class Geocache implements ICache, IWaypoint {
/**
* Attention, calling this method may trigger a database access for the cache!
*/
- @Override
public String getDescription() {
initializeCacheTexts();
assertTextNotNull(description, "Description");
@@ -654,7 +655,6 @@ public class Geocache implements ICache, IWaypoint {
/**
* Attention, calling this method may trigger a database access for the cache!
*/
- @Override
public String getShortDescription() {
initializeCacheTexts();
assertTextNotNull(shortdesc, "Short description");
@@ -666,7 +666,6 @@ public class Geocache implements ICache, IWaypoint {
return name;
}
- @Override
public String getCacheId() {
if (StringUtils.isBlank(cacheId) && getConnector().equals(GCConnector.getInstance())) {
return String.valueOf(GCConstants.gccodeToGCId(geocode));
@@ -675,7 +674,6 @@ public class Geocache implements ICache, IWaypoint {
return cacheId;
}
- @Override
public String getGuid() {
return guid;
}
@@ -683,14 +681,12 @@ public class Geocache implements ICache, IWaypoint {
/**
* Attention, calling this method may trigger a database access for the cache!
*/
- @Override
public String getLocation() {
initializeCacheTexts();
assertTextNotNull(location, "Location");
return location;
}
- @Override
public String getPersonalNote() {
// non premium members have no personal notes, premium members have an empty string by default.
// map both to null, so other code doesn't need to differentiate
@@ -743,12 +739,14 @@ public class Geocache implements ICache, IWaypoint {
this.description = description;
}
- @Override
public boolean isFound() {
return BooleanUtils.isTrue(found);
}
- @Override
+ /**
+ *
+ * @return {@code true} if the user has put a favorite point onto this cache
+ */
public boolean isFavorite() {
return BooleanUtils.isTrue(favorite);
}
@@ -757,18 +755,15 @@ public class Geocache implements ICache, IWaypoint {
this.favorite = favorite;
}
- @Override
@Nullable
public Date getHiddenDate() {
return hidden;
}
- @Override
public List<String> getAttributes() {
return attributes.getUnderlyingList();
}
- @Override
public List<Trackable> getInventory() {
return inventory;
}
@@ -780,22 +775,24 @@ public class Geocache implements ICache, IWaypoint {
spoilers.add(spoiler);
}
- @Override
public List<Image> getSpoilers() {
return ListUtils.unmodifiableList(ListUtils.emptyIfNull(spoilers));
}
- @Override
+ /**
+ * @return a statistic how often the caches has been found, disabled, archived etc.
+ */
public Map<LogType, Integer> getLogCounts() {
return logCounts;
}
- @Override
public int getFavoritePoints() {
return favoritePoints;
}
- @Override
+ /**
+ * @return the normalized cached name to be used for sorting, taking into account the numerical parts in the name
+ */
public String getNameForSorting() {
if (null == nameForSorting) {
nameForSorting = name;
@@ -896,8 +893,6 @@ public class Geocache implements ICache, IWaypoint {
/**
* Set reliable coordinates
- *
- * @param coords
*/
public void setCoords(final Geopoint coords) {
this.coords = new UncertainProperty<>(coords);
@@ -905,9 +900,6 @@ public class Geocache implements ICache, IWaypoint {
/**
* Set unreliable coordinates from a certain map zoom level
- *
- * @param coords
- * @param zoomlevel
*/
public void setCoords(final Geopoint coords, final int zoomlevel) {
this.coords = new UncertainProperty<>(coords, zoomlevel);
@@ -964,7 +956,9 @@ public class Geocache implements ICache, IWaypoint {
this.inventoryItems = inventoryItems;
}
- @Override
+ /**
+ * @return {@code true} if the cache is on the user's watchlist, {@code false} otherwise
+ */
public boolean isOnWatchlist() {
return BooleanUtils.isTrue(onWatchlist);
}
@@ -1148,7 +1142,6 @@ public class Geocache implements ICache, IWaypoint {
*
* @returns Never null
*/
- @Override
public CacheType getType() {
return cacheType.getValue();
}
@@ -1329,8 +1322,6 @@ public class Geocache implements ICache, IWaypoint {
/**
* deletes any waypoint
- *
- * @param waypoint
*/
public void deleteWaypointForce(final Waypoint waypoint) {
@@ -1750,8 +1741,6 @@ public class Geocache implements ICache, IWaypoint {
/**
* Get number of overall finds for a cache, or 0 if the number of finds is not known.
- *
- * @return
*/
public int getFindsCount() {
if (getLogCounts().isEmpty()) {
diff --git a/main/src/cgeo/geocaching/ICache.java b/main/src/cgeo/geocaching/ICache.java
deleted file mode 100644
index b99d877..0000000
--- a/main/src/cgeo/geocaching/ICache.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- *
- */
-package cgeo.geocaching;
-
-import cgeo.geocaching.enumerations.CacheSize;
-import cgeo.geocaching.enumerations.CacheType;
-import cgeo.geocaching.enumerations.LogType;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Basic interface for caches
- */
-public interface ICache extends ILogable, ICoordinates {
-
- /**
- * @return Displayed owner, might differ from the real owner
- */
- public String getOwnerDisplayName();
-
- /**
- * @return GC username of the (actual) owner, might differ from the owner. Never empty.
- */
- public String getOwnerUserId();
-
- /**
- * @return true if the user is the owner of the cache, false else
- */
- public boolean isOwner();
-
- /**
- * @return true is the cache is archived, false else
- */
- public boolean isArchived();
-
- /**
- * @return true is the cache is a Premium Member cache only, false else
- */
- public boolean isPremiumMembersOnly();
-
- /**
- * @return Decrypted hint
- */
- public String getHint();
-
- /**
- * @return Description
- */
- public String getDescription();
-
- /**
- * @return Short Description
- */
- public String getShortDescription();
-
-
- /**
- * @return Id
- */
- public String getCacheId();
-
- /**
- * @return Guid
- */
- public String getGuid();
-
- /**
- * @return Location
- */
- public String getLocation();
-
- /**
- * @return Personal note
- */
- public String getPersonalNote();
-
-
- /**
- * @return true if the user gave a favorite point to the cache
- *
- */
- public boolean isFavorite();
-
- /**
- * @return number of favorite points
- *
- */
- public int getFavoritePoints();
-
- /**
- * @return true if the cache is on the watchlist of the user
- *
- */
- public boolean isOnWatchlist();
-
- /**
- * @return The date the cache has been hidden
- *
- */
- public Date getHiddenDate();
-
- /**
- * null safe list of attributes
- *
- * @return the list of attributes for this cache
- */
- public List<String> getAttributes();
-
- /**
- * @return the list of trackables in this cache
- */
- public List<Trackable> getInventory();
-
- /**
- * @return the list of spoiler images
- */
- public List<Image> getSpoilers();
-
- /**
- * @return a statistic how often the caches has been found, disabled, archived etc.
- */
- public Map<LogType, Integer> getLogCounts();
-
- /**
- * get the name for lexicographical sorting.
- *
- * @return normalized, cached name which sort also correct for numerical parts in the name
- */
- public String getNameForSorting();
-
- /**
- * @return Tradi, multi etc.
- */
- CacheType getType();
-
- /**
- * @return Micro, small etc.
- */
- CacheSize getSize();
-
- /**
- * @return true if the user already found the cache
- *
- */
- boolean isFound();
-
- /**
- * @return true if the cache is disabled, false else
- */
- boolean isDisabled();
-
- /**
- * @return Difficulty assessment
- */
- float getDifficulty();
-
- /**
- * @return Terrain assessment
- */
- float getTerrain();
-}
diff --git a/main/src/cgeo/geocaching/connector/ConnectorFactory.java b/main/src/cgeo/geocaching/connector/ConnectorFactory.java
index 6bbfae0..d4d051f 100644
--- a/main/src/cgeo/geocaching/connector/ConnectorFactory.java
+++ b/main/src/cgeo/geocaching/connector/ConnectorFactory.java
@@ -1,6 +1,6 @@
package cgeo.geocaching.connector;
-import cgeo.geocaching.ICache;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Trackable;
@@ -144,7 +144,7 @@ public final class ConnectorFactory {
}
public static @NonNull
- IConnector getConnector(final ICache cache) {
+ IConnector getConnector(final Geocache cache) {
return getConnector(cache.getGeocode());
}
diff --git a/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java b/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java
index 3992013..3c72c89 100644
--- a/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java
+++ b/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
@@ -24,7 +23,7 @@ public class GeocachingAustraliaConnector extends AbstractConnector {
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return false;
}
diff --git a/main/src/cgeo/geocaching/connector/GeopeitusConnector.java b/main/src/cgeo/geocaching/connector/GeopeitusConnector.java
index aa08485..8b82c1b 100644
--- a/main/src/cgeo/geocaching/connector/GeopeitusConnector.java
+++ b/main/src/cgeo/geocaching/connector/GeopeitusConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
@@ -24,7 +23,7 @@ public class GeopeitusConnector extends AbstractConnector {
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return false;
}
diff --git a/main/src/cgeo/geocaching/connector/IConnector.java b/main/src/cgeo/geocaching/connector/IConnector.java
index c235df4..9c1e8fc 100644
--- a/main/src/cgeo/geocaching/connector/IConnector.java
+++ b/main/src/cgeo/geocaching/connector/IConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Geopoint;
@@ -189,7 +188,7 @@ public interface IConnector {
* @param cache a cache that this connector must be able to handle
* @return <code>true</code> if the current user is the cache owner, <code>false</code> otherwise
*/
- public boolean isOwner(final ICache cache);
+ public boolean isOwner(final Geocache cache);
/**
* Check if the cache information is complete enough to be
diff --git a/main/src/cgeo/geocaching/connector/UnknownConnector.java b/main/src/cgeo/geocaching/connector/UnknownConnector.java
index 05593d7..a2eb8e4 100644
--- a/main/src/cgeo/geocaching/connector/UnknownConnector.java
+++ b/main/src/cgeo/geocaching/connector/UnknownConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
@@ -24,7 +23,7 @@ public class UnknownConnector extends AbstractConnector {
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return false;
}
diff --git a/main/src/cgeo/geocaching/connector/WaymarkingConnector.java b/main/src/cgeo/geocaching/connector/WaymarkingConnector.java
index 282ee31..d6eaab5 100644
--- a/main/src/cgeo/geocaching/connector/WaymarkingConnector.java
+++ b/main/src/cgeo/geocaching/connector/WaymarkingConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
@@ -24,7 +23,7 @@ public class WaymarkingConnector extends AbstractConnector {
}
@Override
- public boolean isOwner(ICache cache) {
+ public boolean isOwner(Geocache cache) {
// this connector has no user management
return false;
}
diff --git a/main/src/cgeo/geocaching/connector/ec/ECConnector.java b/main/src/cgeo/geocaching/connector/ec/ECConnector.java
index 27b5b54..e884f85 100644
--- a/main/src/cgeo/geocaching/connector/ec/ECConnector.java
+++ b/main/src/cgeo/geocaching/connector/ec/ECConnector.java
@@ -2,7 +2,6 @@ package cgeo.geocaching.connector.ec;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
@@ -115,7 +114,7 @@ public class ECConnector extends AbstractConnector implements ISearchByGeocode,
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return false;
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
index 8b714c7..099fd79 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
@@ -3,7 +3,6 @@ package cgeo.geocaching.connector.gc;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
@@ -193,7 +192,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
final String user = Settings.getUsername();
return StringUtils.isNotEmpty(user) && StringUtils.equalsIgnoreCase(cache.getOwnerUserId(), user);
}
diff --git a/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java b/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java
index b56055a..e8f20c9 100644
--- a/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java
+++ b/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java
@@ -3,7 +3,6 @@ package cgeo.geocaching.connector.oc;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.connector.ILoggingManager;
@@ -150,7 +149,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return StringUtils.isNotEmpty(getUserName()) && StringUtils.equals(cache.getOwnerDisplayName(), getUserName());
}
diff --git a/main/src/cgeo/geocaching/connector/oc/OCConnector.java b/main/src/cgeo/geocaching/connector/oc/OCConnector.java
index 1ba88d5..9c79f71 100644
--- a/main/src/cgeo/geocaching/connector/oc/OCConnector.java
+++ b/main/src/cgeo/geocaching/connector/oc/OCConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector.oc;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.R;
import cgeo.geocaching.connector.AbstractConnector;
import cgeo.geocaching.enumerations.LogType;
@@ -54,7 +53,7 @@ public class OCConnector extends AbstractConnector {
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return false;
}
diff --git a/main/src/cgeo/geocaching/connector/ox/OXConnector.java b/main/src/cgeo/geocaching/connector/ox/OXConnector.java
index 6bb5bce..dd048f9 100644
--- a/main/src/cgeo/geocaching/connector/ox/OXConnector.java
+++ b/main/src/cgeo/geocaching/connector/ox/OXConnector.java
@@ -1,7 +1,6 @@
package cgeo.geocaching.connector.ox;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.connector.AbstractConnector;
import cgeo.geocaching.connector.capability.ISearchByCenter;
@@ -56,7 +55,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I
}
@Override
- public boolean isOwner(final ICache cache) {
+ public boolean isOwner(final Geocache cache) {
return false;
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index 93d7098..995c436 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -1,7 +1,7 @@
package cgeo.geocaching.enumerations;
import cgeo.geocaching.CgeoApplication;
-import cgeo.geocaching.ICache;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import java.util.Collections;
@@ -123,7 +123,7 @@ public enum CacheType {
* @param cache
* @return true if this is the ALL type or if this type equals the type of the cache.
*/
- public boolean contains(final ICache cache) {
+ public boolean contains(final Geocache cache) {
if (cache == null) {
return false;
}
diff --git a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java
index 34422ff..8d9d7af 100644
--- a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java
+++ b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java
@@ -6,6 +6,8 @@ import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Geopoint;
+import org.eclipse.jdt.annotation.NonNull;
+
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
@@ -58,6 +60,7 @@ public class GC1ZXX2 extends MockedCache {
return true;
}
+ @NonNull
@Override
public String getOwnerUserId() {
return "daniel354";
diff --git a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java
index bf01f61..8a8cf95 100644
--- a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java
+++ b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java
@@ -7,6 +7,8 @@ import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.settings.Settings;
+import org.eclipse.jdt.annotation.NonNull;
+
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
@@ -39,6 +41,7 @@ public class GC2CJPF extends MockedCache {
return "Tom03";
}
+ @NonNull
@Override
public String getOwnerUserId() {
return getOwnerDisplayName();
diff --git a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java
index cfccc3a..dff6bce 100644
--- a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java
+++ b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java
@@ -8,6 +8,8 @@ import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Geopoint;
+import org.eclipse.jdt.annotation.NonNull;
+
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
@@ -56,6 +58,7 @@ public class GC2JVEH extends MockedCache {
return "indianerjones, der merlyn,reflektordetektor";
}
+ @NonNull
@Override
public String getOwnerUserId() {
return "indianerjones";
diff --git a/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java b/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java
index 9f69e8e..d468b3b 100644
--- a/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java
+++ b/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java
@@ -6,6 +6,8 @@ import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Geopoint;
+import org.eclipse.jdt.annotation.NonNull;
+
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
@@ -58,6 +60,7 @@ public class GC3XX5J extends MockedCache {
return false;
}
+ @NonNull
@Override
public String getOwnerUserId() {
return "David & Ajda";
diff --git a/tests/src/cgeo/geocaching/test/mock/MockedCache.java b/tests/src/cgeo/geocaching/test/mock/MockedCache.java
index 6fb249d..14d8d70 100644
--- a/tests/src/cgeo/geocaching/test/mock/MockedCache.java
+++ b/tests/src/cgeo/geocaching/test/mock/MockedCache.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.test.mock;
import static org.assertj.core.api.Assertions.assertThat;
-import cgeo.geocaching.ICache;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.Image;
import cgeo.geocaching.Trackable;
import cgeo.geocaching.connector.gc.GCConstants;
@@ -20,10 +20,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
-public abstract class MockedCache implements ICache {
+public abstract class MockedCache extends Geocache {
final protected Geopoint coords;
- private String data;
+ private final String data;
private String mockedDataUser;
protected MockedCache(final Geopoint coords) {
@@ -38,7 +38,7 @@ public abstract class MockedCache implements ICache {
return mockedDataUser;
}
- public void setMockedDataUser(String mockedDataUser) {
+ public void setMockedDataUser(final String mockedDataUser) {
this.mockedDataUser = mockedDataUser;
assertThat(StringUtils.isNotBlank(this.mockedDataUser)).isTrue();
}
@@ -71,7 +71,7 @@ public abstract class MockedCache implements ICache {
}
return TextUtils.replaceWhitespace(buffer.toString());
- } catch (IOException e) {
+ } catch (final IOException e) {
Assert.fail(e.getMessage());
} finally {
IOUtils.closeQuietly(is);
diff --git a/tests/src/cgeo/test/Compare.java b/tests/src/cgeo/test/Compare.java
index cabbf43..dbc4732 100644
--- a/tests/src/cgeo/test/Compare.java
+++ b/tests/src/cgeo/test/Compare.java
@@ -3,7 +3,6 @@ package cgeo.test;
import static org.assertj.core.api.Assertions.assertThat;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.ICache;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.utils.CryptUtils;
@@ -13,7 +12,7 @@ import java.util.Date;
public abstract class Compare {
- public static void assertCompareCaches(ICache expected, Geocache actual, boolean all) {
+ public static void assertCompareCaches(Geocache expected, Geocache actual, boolean all) {
final String geocode = expected.getGeocode();
final String cacheStr = "Cache " + geocode + ": ";
assertThat(actual).isNotNull();