diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/test/mock')
6 files changed, 32 insertions, 32 deletions
diff --git a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java index e566ca2..6de8f4f 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java +++ b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java @@ -5,11 +5,11 @@ import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.utils.LazyInitializedList; import java.text.ParseException; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; @@ -95,8 +95,8 @@ public class GC1ZXX2 extends MockedCache { } @Override - public LazyInitializedList<String> getAttributes() { - String[] attributes = new String[] { + public List<String> getAttributes() { + final String[] attributes = new String[] { "bicycles_yes", "available_yes", "stroller_yes", @@ -111,7 +111,7 @@ public class GC1ZXX2 extends MockedCache { @Override public Map<LogType, Integer> getLogCounts() { - Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>(); + final Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>(); logCounts.put(LogType.PUBLISH_LISTING, 1); logCounts.put(LogType.FOUND_IT, 368); logCounts.put(LogType.POST_REVIEWER_NOTE, 1); diff --git a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java index cc19eb3..107384f 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java +++ b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java @@ -6,11 +6,11 @@ import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.utils.LazyInitializedList; import java.text.ParseException; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; @@ -103,11 +103,11 @@ public class GC2CJPF extends MockedCache { * @see cgeo.geocaching.test.mock.MockedCache#isOwn() */ @Override - public boolean isOwn() { + public boolean isOwner() { if ("Tom03".equals(Settings.getUsername())) { return true; } - return super.isOwn(); + return super.isOwner(); } @Override @@ -129,8 +129,8 @@ public class GC2CJPF extends MockedCache { } @Override - public LazyInitializedList<String> getAttributes() { - String[] attributes = new String[] { + public List<String> getAttributes() { + final String[] attributes = new String[] { "motorcycles_no", "wheelchair_no", "winter_yes", @@ -147,7 +147,7 @@ public class GC2CJPF extends MockedCache { @Override public Map<LogType, Integer> getLogCounts() { - Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>(); + final Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>(); logCounts.put(LogType.PUBLISH_LISTING, 1); logCounts.put(LogType.FOUND_IT, 119); logCounts.put(LogType.DIDNT_FIND_IT, 3); diff --git a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java index 9aa18f9..9557991 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java +++ b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java @@ -1,13 +1,12 @@ package cgeo.geocaching.test.mock; -import cgeo.geocaching.cgImage; -import cgeo.geocaching.cgTrackable; +import cgeo.geocaching.Image; +import cgeo.geocaching.Trackable; import cgeo.geocaching.connector.gc.Login; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.utils.LazyInitializedList; import java.text.ParseException; import java.util.ArrayList; @@ -98,7 +97,7 @@ public class GC2JVEH extends MockedCache { } @Override - public LazyInitializedList<String> getAttributes() { + public List<String> getAttributes() { final String[] attributes = new String[] { "winter_yes", "flashlight_yes", @@ -133,16 +132,16 @@ public class GC2JVEH extends MockedCache { } @Override - public List<cgTrackable> getInventory() { - final ArrayList<cgTrackable> inventory = new ArrayList<cgTrackable>(); - inventory.add(new cgTrackable()); + public List<Trackable> getInventory() { + final ArrayList<Trackable> inventory = new ArrayList<Trackable>(); + inventory.add(new Trackable()); return inventory; } @Override - public List<cgImage> getSpoilers() { - final ArrayList<cgImage> spoilers = new ArrayList<cgImage>(); - final cgImage mockedImage = new cgImage(null, null, null); + public List<Image> getSpoilers() { + final ArrayList<Image> spoilers = new ArrayList<Image>(); + final Image mockedImage = new Image(null, null, null); spoilers.add(mockedImage); spoilers.add(mockedImage); spoilers.add(mockedImage); diff --git a/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java b/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java index 540ae12..b598cfa 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java +++ b/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java @@ -5,11 +5,11 @@ import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.utils.LazyInitializedList; import java.text.ParseException; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; @@ -95,8 +95,8 @@ public class GC3XX5J extends MockedCache { } @Override - public LazyInitializedList<String> getAttributes() { - String[] attributes = new String[] { + public List<String> getAttributes() { + final String[] attributes = new String[] { "stroller_no", "kids_no", "bicycles_yes", @@ -114,7 +114,7 @@ public class GC3XX5J extends MockedCache { @Override public Map<LogType, Integer> getLogCounts() { - Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>(); + final Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>(); logCounts.put(LogType.PUBLISH_LISTING, 2); logCounts.put(LogType.FOUND_IT, 65); logCounts.put(LogType.RETRACT, 1); diff --git a/tests/src/cgeo/geocaching/test/mock/MockedCache.java b/tests/src/cgeo/geocaching/test/mock/MockedCache.java index 352c34d..7ad566a 100644 --- a/tests/src/cgeo/geocaching/test/mock/MockedCache.java +++ b/tests/src/cgeo/geocaching/test/mock/MockedCache.java @@ -1,8 +1,8 @@ package cgeo.geocaching.test.mock; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgImage; -import cgeo.geocaching.cgTrackable; +import cgeo.geocaching.Image; +import cgeo.geocaching.Trackable; import cgeo.geocaching.connector.gc.GCConstants; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.utils.BaseUtils; @@ -70,7 +70,7 @@ public abstract class MockedCache implements ICache { return BaseUtils.replaceWhitespace(buffer.toString()); } catch (IOException e) { - e.printStackTrace(); + Assert.fail(e.getMessage()); } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(br); @@ -94,7 +94,7 @@ public abstract class MockedCache implements ICache { } @Override - public boolean isOwn() { + public boolean isOwner() { return false; } @@ -134,12 +134,12 @@ public abstract class MockedCache implements ICache { } @Override - public List<cgTrackable> getInventory() { + public List<Trackable> getInventory() { return null; } @Override - public List<cgImage> getSpoilers() { + public List<Image> getSpoilers() { return null; } diff --git a/tests/src/cgeo/geocaching/test/mock/MockedLazyInitializedList.java b/tests/src/cgeo/geocaching/test/mock/MockedLazyInitializedList.java index a3dd5e3..b67efda 100644 --- a/tests/src/cgeo/geocaching/test/mock/MockedLazyInitializedList.java +++ b/tests/src/cgeo/geocaching/test/mock/MockedLazyInitializedList.java @@ -9,11 +9,12 @@ import java.util.List; class MockedLazyInitializedList<ElementType> extends LazyInitializedList<ElementType> { public MockedLazyInitializedList(ElementType[] elements) { - set(Arrays.asList(elements)); + clear(); + addAll(Arrays.asList(elements)); } @Override - protected List<ElementType> loadFromDatabase() { + public List<ElementType> call() { return new ArrayList<ElementType>(); } |
