diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2015-01-01 23:19:15 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2015-01-01 23:19:15 +0100 |
commit | 839a82a1dda9de1d3cd126f874645cec4425c04f (patch) | |
tree | d29c6610641e9871a50663cf0df7dce4481e809f /tests | |
parent | 5a9eb4f42b3f22be6fe28da09c8635ac09d814ed (diff) | |
download | cgeo-839a82a1dda9de1d3cd126f874645cec4425c04f.zip cgeo-839a82a1dda9de1d3cd126f874645cec4425c04f.tar.gz cgeo-839a82a1dda9de1d3cd126f874645cec4425c04f.tar.bz2 |
refactoring: assert without parenthesis
Diffstat (limited to 'tests')
6 files changed, 20 insertions, 21 deletions
diff --git a/tests/src/cgeo/geocaching/CgeoApplicationTest.java b/tests/src/cgeo/geocaching/CgeoApplicationTest.java index beb33cd..bb61b34 100644 --- a/tests/src/cgeo/geocaching/CgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/CgeoApplicationTest.java @@ -72,7 +72,7 @@ public class CgeoApplicationTest extends CGeoTestCase { public static void testSearchTrackable() { final Trackable tb = GCParser.searchTrackable("TB2J1VZ", null, null); assertThat(tb).isNotNull(); - assert (tb != null); // eclipse bug + assert tb != null; // eclipse bug // fix data assertThat(tb.getGuid()).isEqualTo("aefffb86-099f-444f-b132-605436163aa8"); assertThat(tb.getGeocode()).isEqualTo("TB2J1VZ"); @@ -172,7 +172,7 @@ public class CgeoApplicationTest extends CGeoTestCase { final Geocache searchedCache = search.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); // coords must be null if the user is not logged in assertThat(searchedCache).isNotNull(); - assert (searchedCache != null); // eclipse bug + assert searchedCache != null; // eclipse bug assertThat(searchedCache.getCoords()).isNull(); // premium cache. Not visible to guests @@ -312,7 +312,7 @@ public class CgeoApplicationTest extends CGeoTestCase { assertThat(search).isNotNull(); assertThat(search.getGeocodes().contains(mockedCache.getGeocode())).isTrue(); Geocache parsedCache = DataStore.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); - assert (parsedCache != null); + assert parsedCache != null; assertThat(parsedCache).isNotNull(); assertThat(mockedCache.getCoords().equals(parsedCache.getCoords())).isEqualTo(Settings.isGCPremiumMember()); @@ -326,7 +326,7 @@ public class CgeoApplicationTest extends CGeoTestCase { assertThat(search).isNotNull(); assertThat(search.getGeocodes().contains(mockedCache.getGeocode())).isTrue(); parsedCache = DataStore.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); - assert (parsedCache != null); + assert parsedCache != null; assertThat(parsedCache).isNotNull(); assertThat(mockedCache.getCoords().equals(parsedCache.getCoords())).isEqualTo(Settings.isGCPremiumMember()); @@ -370,7 +370,7 @@ public class CgeoApplicationTest extends CGeoTestCase { assertThat(search.getGeocodes().contains(cache.getGeocode())).isTrue(); // coords differ final Geocache cacheFromViewport = DataStore.loadCache(cache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); - assert (cacheFromViewport != null); + assert cacheFromViewport != null; assertThat(cacheFromViewport).isNotNull(); Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords expected = " + cache.getCoords()); Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords actual = " + cacheFromViewport.getCoords()); diff --git a/tests/src/cgeo/geocaching/DataStoreTest.java b/tests/src/cgeo/geocaching/DataStoreTest.java index 36bfe47..9ef5dda 100644 --- a/tests/src/cgeo/geocaching/DataStoreTest.java +++ b/tests/src/cgeo/geocaching/DataStoreTest.java @@ -59,7 +59,6 @@ public class DataStoreTest extends CGeoTestCase { // get list final StoredList list1 = DataStore.getList(listId1); - assert (list1 != null); assertThat(list1).isNotNull(); assertThat(list1.title).isEqualTo("DataStore Test (renamed)"); @@ -125,7 +124,7 @@ public class DataStoreTest extends CGeoTestCase { try { DataStore.saveCache(cache, EnumSet.of(SaveFlag.DB)); final Geocache loadedCache = DataStore.loadCache(GEOCODE_CACHE, LoadFlags.LOAD_ALL_DB_ONLY); - assert (loadedCache != null); + assert loadedCache != null; assertThat(loadedCache).isNotNull(); assertThat(loadedCache).overridingErrorMessage("Cache was not saved.").isNotNull(); assertThat(loadedCache.getInventory()).hasSize(1); diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java index 254d0b8..058163a 100644 --- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java +++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java @@ -57,7 +57,7 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { assertThat(result.getCount()).isEqualTo(1); final Geocache cache = result.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); assertThat(cache).isNotNull(); - assert (cache != null); // eclipse bug + assert cache != null; // eclipse bug assertThat(cache.getName()).isEqualTo(cacheName); } @@ -160,7 +160,7 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { final String page = GCParser.requestHtmlPage(cache.getGeocode(), null, "n"); final Geocache cache2 = GCParser.parseAndSaveCacheFromText(page, null).getFirstCacheFromResult(LoadFlags.LOAD_CACHE_ONLY); assertThat(cache2).isNotNull(); - assert (cache2 != null); // eclipse bug + assert cache2 != null; // eclipse bug assertThat(cache2.hasUserModifiedCoords()).isTrue(); assertEquals(new Geopoint("N51 21.544", "E07 02.566"), cache2.getCoords()); // delete coordinates @@ -169,7 +169,7 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { final String page2 = GCParser.requestHtmlPage(cache.getGeocode(), null, "n"); final Geocache cache3 = GCParser.parseAndSaveCacheFromText(page2, null).getFirstCacheFromResult(LoadFlags.LOAD_CACHE_ONLY); assertThat(cache3).isNotNull(); - assert (cache3 != null); // eclipse bug + assert cache3 != null; // eclipse bug assertThat(cache3.hasUserModifiedCoords()).isFalse(); } diff --git a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java index 7b011f3..aa66ac9 100644 --- a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java +++ b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java @@ -19,7 +19,7 @@ public class OkapiClientTest extends CGeoTestCase { assertThat(cache.isDetailed()).isTrue(); // cache should be stored to DB (to listID 0) when loaded above cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertThat(cache.getGeocode()).isEqualTo(geoCode); assertThat(cache.getName()).isEqualTo("Oshkosh Municipal Tank"); @@ -42,7 +42,7 @@ public class OkapiClientTest extends CGeoTestCase { assertThat(cache).as("Cache from OKAPI").isNotNull(); // cache should be stored to DB (to listID 0) when loaded above cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertThat(cache.getWaypoints()).hasSize(3); diff --git a/tests/src/cgeo/geocaching/files/GPXImporterTest.java b/tests/src/cgeo/geocaching/files/GPXImporterTest.java index 7b9d9ac..9426fe8 100644 --- a/tests/src/cgeo/geocaching/files/GPXImporterTest.java +++ b/tests/src/cgeo/geocaching/files/GPXImporterTest.java @@ -78,7 +78,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj; assertThat(new ArrayList<String>(search.getGeocodes())).isEqualTo(Collections.singletonList(geocode)); final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); @@ -103,7 +103,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj; assertThat(new ArrayList<String>(search.getGeocodes())).isEqualTo(Collections.singletonList(geocode)); final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); @@ -132,7 +132,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { final SearchResult search = (SearchResult) importStepHandler.messages.get(4).obj; assertThat(new ArrayList<String>(search.getGeocodes())).isEqualTo(Collections.singletonList("GC31J2H")); final Geocache cache = DataStore.loadCache("GC31J2H", LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); assertThat(cache.getWaypoints()).hasSize(2); @@ -147,7 +147,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED); final Geocache cache = DataStore.loadCache("AID1", LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); assertThat(cache.getName()).isEqualTo("First Aid Station #1"); @@ -213,7 +213,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj; assertThat(new ArrayList<String>(search.getGeocodes())).isEqualTo(Collections.singletonList(geocode)); final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); @@ -233,7 +233,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { final SearchResult search = (SearchResult) importStepHandler.messages.get(4).obj; assertThat(new ArrayList<String>(search.getGeocodes())).isEqualTo(Collections.singletonList(geocode)); final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); assertThat(cache.getWaypoints()).hasSize(1); // this is the original pocket query result without test waypoint @@ -261,7 +261,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase { final SearchResult search = (SearchResult) importStepHandler.messages.get(4).obj; assertThat(new ArrayList<String>(search.getGeocodes())).isEqualTo(Collections.singletonList(geocode)); final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); - assert (cache != null); + assert cache != null; assertThat(cache).isNotNull(); assertCacheProperties(cache); assertThat(cache.getWaypoints()).hasSize(1); // this is the original pocket query result without test waypoint diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index 43fda22..2cc1f34 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -286,7 +286,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { DataStore.removeAllFromCache(); // load only the minimum cache, it has several members missing final Geocache minimalCache = DataStore.loadCache(geocode, EnumSet.of(LoadFlag.DB_MINIMAL)); - assert (minimalCache != null); + assert minimalCache != null; assertThat(minimalCache).isNotNull(); // now check that we load lazy members on demand @@ -378,7 +378,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { final List<Geocache> caches = readGPX10(R.raw.tc2012); final Geocache mystery = getCache(caches, "U017"); assertThat(mystery).isNotNull(); - assert (mystery != null); + assert mystery != null; assertThat(mystery.getType()).isEqualTo(CacheType.MYSTERY); } |