diff options
Diffstat (limited to 'tests')
12 files changed, 37 insertions, 44 deletions
diff --git a/tests/src/cgeo/geocaching/ParametersTest.java b/tests/src/cgeo/geocaching/ParametersTest.java index 41d6b55..1855946 100644 --- a/tests/src/cgeo/geocaching/ParametersTest.java +++ b/tests/src/cgeo/geocaching/ParametersTest.java @@ -8,10 +8,9 @@ import java.security.InvalidParameterException; import junit.framework.Assert; -@SuppressWarnings("static-method") public class ParametersTest extends AndroidTestCase { - public void testException() { + public static void testException() { try { @SuppressWarnings("unused") final Parameters params = new Parameters("aaa", "AAA", "bbb"); @@ -28,13 +27,13 @@ public class ParametersTest extends AndroidTestCase { } } - public void testMultipleValues() { + public static void testMultipleValues() { final Parameters params = new Parameters("aaa", "AAA", "bbb", "BBB"); params.put("ccc", "CCC", "ddd", "DDD"); Assert.assertEquals("aaa=AAA&bbb=BBB&ccc=CCC&ddd=DDD", params.toString()); } - public void testSort() { + public static void testSort() { final Parameters params = new Parameters(); params.put("aaa", "AAA"); params.put("ccc", "CCC"); @@ -44,7 +43,7 @@ public class ParametersTest extends AndroidTestCase { Assert.assertEquals("aaa=AAA&bbb=BBB&ccc=CCC", params.toString()); } - public void testToString() { + public static void testToString() { final Parameters params = new Parameters(); params.put("name", "foo&bar"); params.put("type", "moving"); diff --git a/tests/src/cgeo/geocaching/SettingsTest.java b/tests/src/cgeo/geocaching/SettingsTest.java index 49ef596..c31e635 100644 --- a/tests/src/cgeo/geocaching/SettingsTest.java +++ b/tests/src/cgeo/geocaching/SettingsTest.java @@ -20,7 +20,7 @@ public class SettingsTest extends ActivityInstrumentationTestCase2<cgeo> { * access settings. * this should work fine without an exception (once there was an exception because of the empty map file string) */ - public void testSettingsException() { + public static void testSettingsException() { // asserts A OR NOT A, because we don't know what the settings are on any device or emulator assertTrue(Settings.isValidMapFile() || !Settings.isValidMapFile()); } diff --git a/tests/src/cgeo/geocaching/cgWaypointTest.java b/tests/src/cgeo/geocaching/cgWaypointTest.java index aee101e..b7370ed 100644 --- a/tests/src/cgeo/geocaching/cgWaypointTest.java +++ b/tests/src/cgeo/geocaching/cgWaypointTest.java @@ -8,8 +8,7 @@ import junit.framework.Assert; public class cgWaypointTest extends AndroidTestCase { - @SuppressWarnings("static-method") - public void testOrder() { + public static void testOrder() { final cgWaypoint wp1 = new cgWaypoint(); final cgWaypoint wp2 = new cgWaypoint(); diff --git a/tests/src/cgeo/geocaching/cgeoApplicationTest.java b/tests/src/cgeo/geocaching/cgeoApplicationTest.java index 1fbe18c..080f829 100644 --- a/tests/src/cgeo/geocaching/cgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/cgeoApplicationTest.java @@ -69,13 +69,13 @@ public class cgeoApplicationTest extends ApplicationTestCase<cgeoapplication> { * @param base */ @MediumTest - public void testParseCache() { + public static void testParseCache() { final List<MockedCache> cachesToTest = new ArrayList<MockedCache>(); cachesToTest.add(new GC2CJPF()); cachesToTest.add(new GC1ZXX2()); for (MockedCache cache : cachesToTest) { - cgCacheWrap caches = base.parseCache(cache.getData(), 0); + cgCacheWrap caches = cgBase.parseCache(cache.getData(), 0); cgCache cacheParsed = caches.cacheList.get(0); Assert.assertEquals(cache.getGeocode(), cacheParsed.getGeocode()); Assert.assertEquals(cache.getType(), cacheParsed.getType()); @@ -101,8 +101,8 @@ public class cgeoApplicationTest extends ApplicationTestCase<cgeoapplication> { } } - public void testParseLocationWithLink() { - cgCacheWrap caches = base.parseCache(MockedCache.readCachePage("GCV2R9"), 0); + public static void testParseLocationWithLink() { + cgCacheWrap caches = cgBase.parseCache(MockedCache.readCachePage("GCV2R9"), 0); cgCache cache = caches.cacheList.get(0); Assert.assertEquals("California, United States", cache.getLocation()); } diff --git a/tests/src/cgeo/geocaching/compatibility/CompatibilityTest.java b/tests/src/cgeo/geocaching/compatibility/CompatibilityTest.java index 0dbeb3b..54afd82 100644 --- a/tests/src/cgeo/geocaching/compatibility/CompatibilityTest.java +++ b/tests/src/cgeo/geocaching/compatibility/CompatibilityTest.java @@ -7,7 +7,6 @@ import android.test.ActivityInstrumentationTestCase2; import junit.framework.Assert; -@SuppressWarnings("static-method") public class CompatibilityTest extends ActivityInstrumentationTestCase2<cgeo> { private cgeo activity; @@ -22,7 +21,7 @@ public class CompatibilityTest extends ActivityInstrumentationTestCase2<cgeo> { activity = getActivity(); } - public void testDataChanged() { + public static void testDataChanged() { // This should not raise an exception in any Android version Compatibility.dataChanged("cgeo.geocaching"); } diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 5e45c94..a2512a8 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -98,7 +98,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertEquals(0, caches.size()); } - public void testConvertWaypointSym2Type() { + public static void testConvertWaypointSym2Type() { assertEquals(WaypointType.WAYPOINT, GPXParser.convertWaypointSym2Type("unknown sym")); assertEquals(WaypointType.PKG, GPXParser.convertWaypointSym2Type("Parking area")); @@ -109,7 +109,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertEquals(WaypointType.WAYPOINT, GPXParser.convertWaypointSym2Type("Reference point")); } - private void assertGc31j2h(final cgCache cache) { + private static void assertGc31j2h(final cgCache cache) { assertEquals("GC31J2H", cache.getGeocode()); assertEquals("Hockenheimer City-Brunnen", cache.getName()); assertTrue("Hockenheimer City-Brunnen by vptsz, Multi-cache (2/1)", cache.getShortDescription().startsWith("Kurzer informativer Multi entlang der Brunnen")); @@ -142,7 +142,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertNull(cache.attributes); } - private long parseTime(String time) { + private static long parseTime(final String time) { try { return LOG_DATE_FORMAT.parse(time).getTime(); } catch (ParseException e) { @@ -150,7 +150,7 @@ public class GPXParserTest extends InstrumentationTestCase { } } - private void assertGc31j2hWaypoints(final cgCache cache) { + private static void assertGc31j2hWaypoints(final cgCache cache) { assertNotNull(cache.waypoints); assertEquals(2, cache.waypoints.size()); cgWaypoint wp = cache.waypoints.get(0); @@ -174,7 +174,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertEquals(8.545100, wp.coords.getLongitude(), 0.000001); } - public void testGetWaypointsFileForGpx() { + public static void testGetWaypointsFileForGpx() { assertEquals(new File("1234567-wpts.gpx"), GPXParser.getWaypointsFileForGpx(new File("1234567.gpx"))); assertEquals(new File("/mnt/sdcard/1234567-wpts.gpx"), GPXParser.getWaypointsFileForGpx(new File("/mnt/sdcard/1234567.gpx"))); assertEquals(new File("/mnt/sdcard/1-wpts.gpx"), GPXParser.getWaypointsFileForGpx(new File("/mnt/sdcard/1.gpx"))); diff --git a/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java b/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java index 3e8336b..357d34c 100644 --- a/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java +++ b/tests/src/cgeo/geocaching/geopoint/DistanceParserTest.java @@ -6,12 +6,11 @@ import android.test.AndroidTestCase; import junit.framework.Assert; -@SuppressWarnings("static-method") public class DistanceParserTest extends AndroidTestCase { static private final double MM = 1e-6; // 1mm, in kilometers - public void testFormats() { + public static void testFormats() { Assert.assertEquals(1.2, DistanceParser.parseDistance("1200 m", true), MM); Assert.assertEquals(1.2, DistanceParser.parseDistance("1.2 km", true), MM); Assert.assertEquals(0.36576, DistanceParser.parseDistance("1200 ft", true), MM); @@ -19,16 +18,16 @@ public class DistanceParserTest extends AndroidTestCase { Assert.assertEquals(1.9312128, DistanceParser.parseDistance("1.2 mi", true), MM); } - public void testImplicit() { + public static void testImplicit() { Assert.assertEquals(1.2, DistanceParser.parseDistance("1200", true), MM); Assert.assertEquals(0.36576, DistanceParser.parseDistance("1200", false), MM); } - public void testComma() { + public static void testComma() { Assert.assertEquals(1.2, DistanceParser.parseDistance("1,2km", true), MM); } - public void testCase() { + public static void testCase() { Assert.assertEquals(0.36576, DistanceParser.parseDistance("1200 FT", true), MM); } diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java index 32b7562..a21fa58 100644 --- a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java +++ b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java @@ -7,40 +7,39 @@ import android.test.AndroidTestCase; import junit.framework.Assert; -@SuppressWarnings("static-method") public class GeoPointParserTest extends AndroidTestCase { private static final double refLongitude = 8.0 + 38.564 / 60.0; private static final double refLatitude = 49.0 + 56.031 / 60.0; - public void testParseLatitude() { + public static void testParseLatitude() { Assert.assertEquals(refLatitude, GeopointParser.parseLatitude("N 49° 56.031"), 1e-8); } - public void testParseLongitude() { + public static void testParseLongitude() { Assert.assertEquals(refLongitude, GeopointParser.parseLongitude("E 8° 38.564"), 1e-8); } - public void testFullCoordinates() { + public static void testFullCoordinates() { final Geopoint goal = new Geopoint(refLatitude, refLongitude); Assert.assertTrue(goal.isEqualTo(GeopointParser.parse("N 49° 56.031 | E 8° 38.564"), 1e-6)); } - public void testSouth() { + public static void testSouth() { Assert.assertEquals(-refLatitude, GeopointParser.parseLatitude("S 49° 56.031"), 1e-8); } - public void testWest() { + public static void testWest() { Assert.assertEquals(-refLongitude, GeopointParser.parseLongitude("W 8° 38.564"), 1e-8); } - public void testLowerCase() { + public static void testLowerCase() { Assert.assertEquals(refLongitude, GeopointParser.parseLongitude("e 8° 38.564"), 1e-8); } - public void testVariousFormats() { + public static void testVariousFormats() { final Geopoint goal1 = GeopointParser.parse("N 49° 43' 57\" | E 2 12' 35"); final Geopoint goal2 = GeopointParser.parse("N 49 43.95 E2°12.5833333333"); Assert.assertTrue(goal1.isEqualTo(goal2, 1e-6)); diff --git a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java index ef1955b..068b8cc 100644 --- a/tests/src/cgeo/geocaching/geopoint/GeopointTest.java +++ b/tests/src/cgeo/geocaching/geopoint/GeopointTest.java @@ -7,16 +7,15 @@ import android.test.AndroidTestCase; import junit.framework.Assert; -@SuppressWarnings("static-method") public class GeopointTest extends AndroidTestCase { - public void testCreation() { + public static void testCreation() { final Geopoint gp = new Geopoint(48.2, 3.5); Assert.assertEquals(48.2, gp.getLatitude(), 1e-8); Assert.assertEquals(3.5, gp.getLongitude(), 1e-8); } - public void testCreationAtLimit() { + public static void testCreationAtLimit() { // No exception should be raised at limits. final Geopoint gp1 = new Geopoint(90.0, 10.0); Assert.assertEquals(90, gp1.getLatitude(), 1e-8); @@ -41,33 +40,33 @@ public class GeopointTest extends AndroidTestCase { } } - public void testCreationFails() { + public static void testCreationFails() { createShouldFail(90.1, 0.0); createShouldFail(-90.1, 0.0); createShouldFail(0.0, 180.1); createShouldFail(0.0, -180.1); } - public void testEqual() { + public static void testEqual() { final Geopoint gp1 = new Geopoint(48.2, 2.31); Assert.assertTrue(gp1.equals(gp1)); final Geopoint gp2 = new Geopoint(48.3, 2.31); Assert.assertFalse(gp1.equals(gp2)); } - public void testCreateE6() { + public static void testCreateE6() { final Geopoint gp1 = new Geopoint(48.2, 2.34); final Geopoint gp2 = new Geopoint(48200000, 2340000); Assert.assertTrue(gp1.isEqualTo(gp2, 1e-6)); } - public void testGetE6() { + public static void testGetE6() { final Geopoint gp = new Geopoint(41.2, -3.4); Assert.assertEquals(41200000.0, gp.getLatitudeE6(), 1e-6); Assert.assertEquals(-3400000.0, gp.getLongitudeE6(), 1e-6); } - public void testBearingDistance() { + public static void testBearingDistance() { final Geopoint gp1 = new Geopoint(-30.4, -1.2); final Geopoint gp2 = new Geopoint(-30.1, -2.3); diff --git a/tests/src/cgeo/geocaching/test/RegExPerformanceTest.java b/tests/src/cgeo/geocaching/test/RegExPerformanceTest.java index 2dbbc46..08e60d8 100644 --- a/tests/src/cgeo/geocaching/test/RegExPerformanceTest.java +++ b/tests/src/cgeo/geocaching/test/RegExPerformanceTest.java @@ -106,7 +106,7 @@ public class RegExPerformanceTest extends TestCase { private final static Pattern PATTERN_OWNERREAL = Pattern.compile("<a id=\"ctl00_ContentBody_uxFindLinksHiddenByThisUser\" href=\"[^\"]*/seek/nearest\\.aspx\\?u=(.*?)\""); - public void testRegEx() { + public static void testRegEx() { List<String> output = doTheTests(10); for (String s : output) { diff --git a/tests/src/cgeo/geocaching/test/RegExRealPerformanceTest.java b/tests/src/cgeo/geocaching/test/RegExRealPerformanceTest.java index 971a12f..358466c 100644 --- a/tests/src/cgeo/geocaching/test/RegExRealPerformanceTest.java +++ b/tests/src/cgeo/geocaching/test/RegExRealPerformanceTest.java @@ -15,7 +15,7 @@ import java.util.List; */ public class RegExRealPerformanceTest extends AndroidTestCase { - public void testRegEx() { + public static void testRegEx() { List<String> output = RegExPerformanceTest.doTheTests(10); diff --git a/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java b/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java index 22c87f6..b53220f 100644 --- a/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java +++ b/tests/src/cgeo/geocaching/utils/CryptUtilsTest.java @@ -4,9 +4,8 @@ import cgeo.geocaching.utils.CryptUtils; import junit.framework.TestCase; -@SuppressWarnings("static-method") public class CryptUtilsTest extends TestCase { - public void testROT13() { + public static void testROT13() { assertEquals("", CryptUtils.rot13("")); assertEquals("", CryptUtils.rot13((String) null)); assertEquals("Pnpur uvag", CryptUtils.rot13("Cache hint")); |