aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2015-02-10 18:05:29 +0100
committerBananeweizen <bananeweizen@gmx.de>2015-02-10 18:05:29 +0100
commitd42e2751db06d2221dd4e05ee6d2ec3ca3cbb2df (patch)
treef8b9e2ebeccce1eda98bd314705a140d03e6e17c /tests
parentcb1ac101d464d689beb9fd3b69171d6e63632950 (diff)
downloadcgeo-d42e2751db06d2221dd4e05ee6d2ec3ca3cbb2df.zip
cgeo-d42e2751db06d2221dd4e05ee6d2ec3ca3cbb2df.tar.gz
cgeo-d42e2751db06d2221dd4e05ee6d2ec3ca3cbb2df.tar.bz2
require Javadoc to have tag descriptions or no tags
Diffstat (limited to 'tests')
-rw-r--r--tests/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--tests/src/cgeo/CGeoTestCase.java8
-rw-r--r--tests/src/cgeo/geocaching/CgeoApplicationTest.java10
-rw-r--r--tests/src/cgeo/geocaching/export/GpxSerializerTest.java24
-rw-r--r--tests/src/cgeo/geocaching/sorting/NameComparatorTest.java9
-rw-r--r--tests/src/cgeo/geocaching/test/WhitespaceTest.java4
6 files changed, 23 insertions, 34 deletions
diff --git a/tests/.settings/org.eclipse.jdt.core.prefs b/tests/.settings/org.eclipse.jdt.core.prefs
index 0c3bd0c..af15cda 100644
--- a/tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/.settings/org.eclipse.jdt.core.prefs
@@ -51,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
diff --git a/tests/src/cgeo/CGeoTestCase.java b/tests/src/cgeo/CGeoTestCase.java
index 7fc1e8d..2dbac3d 100644
--- a/tests/src/cgeo/CGeoTestCase.java
+++ b/tests/src/cgeo/CGeoTestCase.java
@@ -29,14 +29,12 @@ public abstract class CGeoTestCase extends ApplicationTestCase<CgeoApplication>
}
/** Remove cache from DB and cache to ensure that the cache is not loaded from the database */
- protected static void deleteCacheFromDB(String geocode) {
+ protected static void deleteCacheFromDB(final String geocode) {
DataStore.removeCache(geocode, LoadFlags.REMOVE_ALL);
}
/**
* remove cache from database and file system
- *
- * @param geocode
*/
protected static void removeCacheCompletely(final String geocode) {
final EnumSet<RemoveFlag> flags = EnumSet.copyOf(LoadFlags.REMOVE_ALL);
@@ -71,10 +69,8 @@ public abstract class CGeoTestCase extends ApplicationTestCase<CgeoApplication>
/**
* can be called after recordMapStoreFlags,
* to set the flags for map storing as necessary
- * @param storeCacheMap
- * @param storeWpMaps
*/
- protected void setMapStoreFlags(boolean storeCacheMap, boolean storeWpMaps) {
+ protected void setMapStoreFlags(final boolean storeCacheMap, final boolean storeWpMaps) {
if (!oldMapStoreFlagsRecorded) {
throw new IllegalStateException("Previous MapStoreFlags havn't been recorded! Setting not allowed");
}
diff --git a/tests/src/cgeo/geocaching/CgeoApplicationTest.java b/tests/src/cgeo/geocaching/CgeoApplicationTest.java
index bb61b34..d9716c0 100644
--- a/tests/src/cgeo/geocaching/CgeoApplicationTest.java
+++ b/tests/src/cgeo/geocaching/CgeoApplicationTest.java
@@ -94,7 +94,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
// no assumption possible: assertThat(tb.getSpottedName()).isEqualTo("Nice place for a break cache");
// we can't check specifics in the log entries since they change, but we can verify data was parsed
- for (LogEntry log : tb.getLogs()) {
+ for (final LogEntry log : tb.getLogs()) {
assertThat(log.date).isGreaterThan(0);
assertThat(log.author).isNotEmpty();
if (log.type == LogType.PLACED_IT || log.type == LogType.RETRIEVED_IT) {
@@ -135,7 +135,6 @@ public class CgeoApplicationTest extends CGeoTestCase {
/**
* Set the login data to the cgeo login, run the given Runnable, and restore the login.
*
- * @param runnable
*/
private static void withMockedLoginDo(final Runnable runnable) {
final ImmutablePair<String, String> login = Settings.getGcCredentials();
@@ -211,9 +210,8 @@ public class CgeoApplicationTest extends CGeoTestCase {
/**
* mock the "exclude disabled caches" and "exclude my caches" options for the execution of the runnable
*
- * @param runnable
*/
- private static void withMockedFilters(Runnable runnable) {
+ private static void withMockedFilters(final Runnable runnable) {
// backup user settings
final boolean excludeMine = Settings.isExcludeMyCaches();
final boolean excludeDisabled = Settings.isExcludeDisabledCaches();
@@ -401,7 +399,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
* Test cache parsing. Esp. useful after a GC.com update
*/
public static void testSearchByGeocodeBasis() {
- for (MockedCache mockedCache : RegExPerformanceTest.MOCKED_CACHES) {
+ for (final MockedCache mockedCache : RegExPerformanceTest.MOCKED_CACHES) {
final String oldUser = mockedCache.getMockedDataUser();
try {
mockedCache.setMockedDataUser(Settings.getUsername());
@@ -425,7 +423,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
}
/** Remove cache from DB and cache to ensure that the cache is not loaded from the database */
- private static void deleteCacheFromDBAndLogout(String geocode) {
+ private static void deleteCacheFromDBAndLogout(final String geocode) {
deleteCacheFromDB(geocode);
GCLogin.getInstance().logout();
diff --git a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
index c43ad38..b20b066 100644
--- a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
+++ b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
@@ -38,13 +38,13 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
final AtomicReference<Integer> importedCount = new AtomicReference<Integer>(0);
final StringWriter writer = new StringWriter();
- Geocache cache = loadCacheFromResource(R.raw.gc1bkp3_gpx101);
+ final Geocache cache = loadCacheFromResource(R.raw.gc1bkp3_gpx101);
assertThat(cache).isNotNull();
new GpxSerializer().writeGPX(Collections.singletonList("GC1BKP3"), writer, new GpxSerializer.ProgressListener() {
@Override
- public void publishProgress(int countExported) {
+ public void publishProgress(final int countExported) {
importedCount.set(countExported);
}
});
@@ -54,8 +54,6 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
/**
* This test verifies that a loop of import, export, import leads to the same cache information.
*
- * @throws IOException
- * @throws ParserException
*/
public void testStableExportImportExport() throws IOException, ParserException {
final String geocode = "GC1BKP3";
@@ -70,7 +68,7 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
final GPX10Parser parser = new GPX10Parser(StoredList.TEMPORARY_LIST.id);
final InputStream stream = new ByteArrayInputStream(gpxFirst.getBytes(CharEncoding.UTF_8));
- Collection<Geocache> caches = parser.parse(stream, null);
+ final Collection<Geocache> caches = parser.parse(stream, null);
assertThat(caches).isNotNull();
assertThat(caches).hasSize(1);
@@ -78,43 +76,43 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
assertThat(replaceLogIds(gpxSecond)).isEqualTo(replaceLogIds(gpxFirst));
}
- private static String replaceLogIds(String gpx) {
+ private static String replaceLogIds(final String gpx) {
return gpx.replaceAll("log id=\"\\d*\"", "");
}
- private static String getGPXFromCache(String geocode) throws IOException {
+ private static String getGPXFromCache(final String geocode) throws IOException {
final StringWriter writer = new StringWriter();
new GpxSerializer().writeGPX(Collections.singletonList(geocode), writer, null);
return writer.toString();
}
public static void testStateFromStateCountry() throws Exception {
- Geocache cache = withLocation("state, country");
+ final Geocache cache = withLocation("state, country");
assertThat(GpxSerializer.getState(cache)).isEqualTo("state");
}
public static void testCountryFromStateCountry() throws Exception {
- Geocache cache = withLocation("state, country");
+ final Geocache cache = withLocation("state, country");
assertThat(GpxSerializer.getCountry(cache)).isEqualTo("country");
}
public static void testCountryFromCountryOnly() throws Exception {
- Geocache cache = withLocation("somewhere");
+ final Geocache cache = withLocation("somewhere");
assertThat(GpxSerializer.getCountry(cache)).isEqualTo("somewhere");
}
public static void testStateFromCountryOnly() throws Exception {
- Geocache cache = withLocation("somewhere");
+ final Geocache cache = withLocation("somewhere");
assertThat(GpxSerializer.getState(cache)).isEmpty();
}
public static void testCountryFromExternalCommaString() throws Exception {
- Geocache cache = withLocation("first,second"); // this was not created by c:geo, therefore don't split it
+ final Geocache cache = withLocation("first,second"); // this was not created by c:geo, therefore don't split it
assertThat(GpxSerializer.getState(cache)).isEmpty();
}
private static Geocache withLocation(final String location) {
- Geocache cache = new Geocache();
+ final Geocache cache = new Geocache();
cache.setLocation(location);
return cache;
}
diff --git a/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java b/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java
index 533135d..6d4fa46 100644
--- a/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java
+++ b/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java
@@ -18,7 +18,7 @@ public class NameComparatorTest extends AndroidTestCase {
}
}
- private NameComparator comp = new NameComparator();
+ private final NameComparator comp = new NameComparator();
public void testLexical() {
assertSorted(new NamedCache("A"), new NamedCache("Z"));
@@ -38,11 +38,10 @@ public class NameComparatorTest extends AndroidTestCase {
/**
* Assert that a given collection of names is already sorted correctly.
*
- * @param names
*/
- private void assertSortedNames(String... names) {
- ArrayList<Geocache> caches = new ArrayList<Geocache>(names.length);
- for (String name : names) {
+ private void assertSortedNames(final String... names) {
+ final ArrayList<Geocache> caches = new ArrayList<Geocache>(names.length);
+ for (final String name : names) {
caches.add(new NamedCache(name));
}
Collections.sort(caches, comp);
diff --git a/tests/src/cgeo/geocaching/test/WhitespaceTest.java b/tests/src/cgeo/geocaching/test/WhitespaceTest.java
index 1ce7cc8..110cdbc 100644
--- a/tests/src/cgeo/geocaching/test/WhitespaceTest.java
+++ b/tests/src/cgeo/geocaching/test/WhitespaceTest.java
@@ -30,8 +30,6 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase {
* The place for the implementation to prove that the new version of replaceWhitespace is faster than
* BaseUtils.replaceWhitespace()
*
- * @param data
- * @return
*/
public static String replaceWhitespaceManually(final String data) {
final int length = data.length();
@@ -39,7 +37,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase {
data.getChars(0, length, chars, 0);
int resultSize = 0;
boolean lastWasWhitespace = true;
- for (char c : chars) {
+ for (final char c : chars) {
if (c == ' ' || c == '\n' || c == '\r' || c == '\t') {
if (!lastWasWhitespace) {
chars[resultSize++] = ' ';