diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2014-11-24 14:19:17 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2014-11-24 14:19:17 +0100 |
commit | 5bce26655db295f1d099c306811d2bc8a6480c91 (patch) | |
tree | aaed09695bcc55667aee7f3841809bd0082d3457 /tests | |
parent | dafa3c377773ea8d08d7d96d3419a0ceb39c25dc (diff) | |
download | cgeo-5bce26655db295f1d099c306811d2bc8a6480c91.zip cgeo-5bce26655db295f1d099c306811d2bc8a6480c91.tar.gz cgeo-5bce26655db295f1d099c306811d2bc8a6480c91.tar.bz2 |
Minor reformattings in tests
Diffstat (limited to 'tests')
4 files changed, 6 insertions, 17 deletions
diff --git a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java index a8a9ced..2b7ef45 100644 --- a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java @@ -2,6 +2,8 @@ package cgeo.geocaching.enumerations; import static org.assertj.core.api.Assertions.assertThat; +import org.apache.commons.lang3.StringUtils; + import android.test.AndroidTestCase; public class CacheAttributeTest extends AndroidTestCase { @@ -16,8 +18,7 @@ public class CacheAttributeTest extends AndroidTestCase { public static void testIds() { for (CacheAttribute attribute : CacheAttribute.values()) { if (attribute != CacheAttribute.UNKNOWN) { - assertThat(attribute.rawName != null).isTrue(); - assertThat(attribute.rawName.length() > 0).isTrue(); + assertThat(StringUtils.isNotEmpty(attribute.rawName)).isTrue(); assertThat(attribute.drawableId != 0).isTrue(); assertThat(attribute.stringIdYes != 0).isTrue(); assertThat(attribute.stringIdNo != 0).isTrue(); diff --git a/tests/src/cgeo/geocaching/location/DistanceParserTest.java b/tests/src/cgeo/geocaching/location/DistanceParserTest.java index 4d9e5a5..3641f6f 100644 --- a/tests/src/cgeo/geocaching/location/DistanceParserTest.java +++ b/tests/src/cgeo/geocaching/location/DistanceParserTest.java @@ -1,7 +1,5 @@ package cgeo.geocaching.location; -import cgeo.geocaching.location.DistanceParser; - import android.test.AndroidTestCase; public class DistanceParserTest extends AndroidTestCase { @@ -25,7 +23,7 @@ public class DistanceParserTest extends AndroidTestCase { assertEquals(1.2, DistanceParser.parseDistance("1,2km", true), MM); } - public static void testCase() { + public static void testFeet() { assertEquals(0.36576, DistanceParser.parseDistance("1200 FT", true), MM); } diff --git a/tests/src/cgeo/geocaching/test/CgeoTestsActivity.java b/tests/src/cgeo/geocaching/test/CgeoTestsActivity.java index c1f6fdd..8959ede 100644 --- a/tests/src/cgeo/geocaching/test/CgeoTestsActivity.java +++ b/tests/src/cgeo/geocaching/test/CgeoTestsActivity.java @@ -79,9 +79,7 @@ public class CgeoTestsActivity extends Activity { Thread.sleep(50); publishProgress(mReader.readLine()); } while (System.currentTimeMillis() < timeout); - } catch (InterruptedException e) { - publishProgress("ERROR: " + e); - } catch (IOException e) { + } catch (InterruptedException | IOException e) { publishProgress("ERROR: " + e); } finally { publishProgress("END"); diff --git a/tests/src/cgeo/junit/CgeoTestRunner.java b/tests/src/cgeo/junit/CgeoTestRunner.java index 7a6f15e..16a5f12 100644 --- a/tests/src/cgeo/junit/CgeoTestRunner.java +++ b/tests/src/cgeo/junit/CgeoTestRunner.java @@ -95,16 +95,8 @@ public class CgeoTestRunner extends GoogleInstrumentationTestRunner { Method m = obj.getClass().getDeclaredMethod("getAndroidTestRunner", (Class[]) null); AndroidTestRunner androidTestRunner = (AndroidTestRunner) m.invoke(obj); androidTestRunner.addTestListener(mListener); - } catch (NoSuchFieldException x) { + } catch (NoSuchFieldException | InvocationTargetException | IllegalAccessException | NoSuchMethodException | SecurityException x) { Log.e(LOG_TAG, x.toString()); - } catch (SecurityException e) { - Log.e(LOG_TAG, e.toString()); - } catch (NoSuchMethodException e) { - Log.e(LOG_TAG, e.toString()); - } catch (IllegalAccessException x) { - Log.e(LOG_TAG, x.toString()); - } catch (InvocationTargetException e) { - Log.e(LOG_TAG, e.toString()); } super.start(); } |