diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-11-24 20:26:35 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-11-24 20:26:35 +0100 |
| commit | 691870bd875a9cdb6d86c848c482eb737e0c6f87 (patch) | |
| tree | ae56f8a7d595c464cf073c2dad2b6402d330c8d5 | |
| parent | 15205a1abf58aaa9fd71f173c47533c9fec6decf (diff) | |
| download | cgeo-691870bd875a9cdb6d86c848c482eb737e0c6f87.zip cgeo-691870bd875a9cdb6d86c848c482eb737e0c6f87.tar.gz cgeo-691870bd875a9cdb6d86c848c482eb737e0c6f87.tar.bz2 | |
refactoring: remove test only methods
6 files changed, 11 insertions, 20 deletions
diff --git a/main/src/cgeo/geocaching/LogEntry.java b/main/src/cgeo/geocaching/LogEntry.java index b4b346c..41c222b 100644 --- a/main/src/cgeo/geocaching/LogEntry.java +++ b/main/src/cgeo/geocaching/LogEntry.java @@ -2,7 +2,6 @@ package cgeo.geocaching; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.settings.Settings; -import cgeo.geocaching.utils.DateUtils; import cgeo.geocaching.utils.HtmlUtils; import cgeo.geocaching.utils.MatcherWrapper; @@ -89,7 +88,7 @@ public final class LogEntry { public CharSequence getImageTitles() { final List<String> titles = new ArrayList<>(5); - for (Image image : getLogImages()) { + for (final Image image : getLogImages()) { if (StringUtils.isNotBlank(image.getTitle())) { titles.add(HtmlUtils.extractText(image.getTitle())); } @@ -100,16 +99,12 @@ public final class LogEntry { return StringUtils.join(titles, ", "); } - public int daysSinceLog() { - return DateUtils.daysSince(date); - } - /** * Get the log text to be displayed. Depending on the settings, color tags might be removed. */ public String getDisplayText() { if (Settings.getPlainLogs()) { - MatcherWrapper matcher = new MatcherWrapper(PATTERN_REMOVE_COLORS, log); + final MatcherWrapper matcher = new MatcherWrapper(PATTERN_REMOVE_COLORS, log); return matcher.replaceAll(StringUtils.EMPTY); } return log; diff --git a/main/src/cgeo/geocaching/connector/NoLoggingManager.java b/main/src/cgeo/geocaching/connector/NoLoggingManager.java index 54d5a10..ff8b33a 100644 --- a/main/src/cgeo/geocaching/connector/NoLoggingManager.java +++ b/main/src/cgeo/geocaching/connector/NoLoggingManager.java @@ -1,6 +1,5 @@ package cgeo.geocaching.connector; -import cgeo.geocaching.Geocache; import cgeo.geocaching.TrackableLog; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.enumerations.StatusCode; diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java index 1fdb0ac..771a508 100644 --- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java +++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java @@ -167,7 +167,7 @@ public enum CacheAttribute { private final static SparseArray<CacheAttribute> FIND_BY_OCACODE = new SparseArray<>(); static { final HashMap<String, CacheAttribute> mapGcRawNames = new HashMap<>(); - for (CacheAttribute attr : values()) { + for (final CacheAttribute attr : values()) { mapGcRawNames.put(attr.rawName, attr); if (attr.ocacode != NO_ID) { FIND_BY_OCACODE.put(attr.ocacode, attr); @@ -184,7 +184,7 @@ public enum CacheAttribute { return FIND_BY_OCACODE.get(ocAcode); } - public static String trimAttributeName(String attributeName) { + public static String trimAttributeName(final String attributeName) { if (null == attributeName) { return ""; } @@ -195,7 +195,4 @@ public enum CacheAttribute { return !StringUtils.endsWithIgnoreCase(attributeName, INTERNAL_NO); } - public String getAttributeName(final boolean yes) { - return rawName + (yes ? INTERNAL_YES : INTERNAL_NO); - } } diff --git a/main/src/cgeo/geocaching/files/ProgressInputStream.java b/main/src/cgeo/geocaching/files/ProgressInputStream.java index 552aee0..3b249a1 100644 --- a/main/src/cgeo/geocaching/files/ProgressInputStream.java +++ b/main/src/cgeo/geocaching/files/ProgressInputStream.java @@ -16,12 +16,12 @@ public class ProgressInputStream extends FilterInputStream { private int progress = 0; - protected ProgressInputStream(InputStream in) { + protected ProgressInputStream(final InputStream in) { super(in); } @Override - public int read() throws IOException { + public int read() throws IOException { // NO_UCD This method is called from the framework final int read = super.read(); if (read >= 0) { progress++; @@ -30,7 +30,7 @@ public class ProgressInputStream extends FilterInputStream { } @Override - public int read(byte[] buffer, int offset, int count) throws IOException { + public int read(final byte[] buffer, final int offset, final int count) throws IOException { final int read = super.read(buffer, offset, count); progress += read; return read; diff --git a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java index 2b7ef45..f9e25bf 100644 --- a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java @@ -44,9 +44,8 @@ public class CacheAttributeTest extends AndroidTestCase { } public static void testIsEnabled() { - final CacheAttribute attribute = CacheAttribute.HIKING; - final String hiking_yes = attribute.getAttributeName(true); - final String hiking_no = attribute.getAttributeName(false); + final String hiking_yes = "hiking_yes"; + final String hiking_no = "hiking_no"; assertThat(CacheAttribute.isEnabled(hiking_yes)).isTrue(); assertThat(CacheAttribute.isEnabled(hiking_no)).isFalse(); } diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 4bbfbff..59b0d4f 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -14,6 +14,7 @@ import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.location.Geopoint; import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase; import cgeo.geocaching.test.R; +import cgeo.geocaching.utils.DateUtils; import cgeo.geocaching.utils.SynchronizedDateFormat; import java.io.IOException; @@ -177,7 +178,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { assertThat(log.log).isEqualTo("Sehr schöne Runde und wir haben wieder etwas Neues über Hockenheim gelernt. Super Tarnung.\nTFTC, Geoteufel"); assertThat(log.isOwn()).isFalse(); assertThat(log.getDisplayText()).isEqualTo(log.log); - assertThat(log.daysSinceLog() > 700).isTrue(); + assertThat(DateUtils.daysSince(log.date) > 700).isTrue(); // following info is not contained in pocket query gpx file assertThat(cache.getAttributes()).isEmpty(); |
