From b9cb0ce062fc21a4d194fdd01ab20b9da04bf00c Mon Sep 17 00:00:00 2001 From: zollty Date: Mon, 15 Nov 2021 17:01:05 +0800 Subject: [PATCH] remove reference to junit in non test code --- app/build.gradle | 2 +- .../ch/blinkenlights/android/vanilla/LibraryActivity.java | 7 ++++--- .../ch/blinkenlights/android/vanilla/SongTimeline.java | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0d558ba13..a0a8bbe5c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,6 +31,6 @@ dependencies { implementation 'androidx.legacy:legacy-support-core-ui:1.0.0' implementation 'androidx.media:media:1.2.1' implementation 'com.google.android.material:material:1.0.0' - implementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.12' compileOnly 'androidx.annotation:annotation:1.0.0' } diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java index 6ecdb8118..a89c6f05a 100644 --- a/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java @@ -58,8 +58,6 @@ import java.io.File; -import junit.framework.Assert; - /** * The library activity where songs to play can be selected from the library. */ @@ -595,7 +593,10 @@ public void onClick(View view) if (i == 1 && type == MediaUtils.TYPE_ALBUM) { setLimiter(MediaUtils.TYPE_ARTIST, limiter.data.toString()); } else if (i > 0) { - Assert.assertEquals(MediaUtils.TYPE_FILE, limiter.type); + if(MediaUtils.TYPE_FILE != limiter.type) { + super.onClick(view); + return; + } File file = (File)limiter.data; int diff = limiter.names.length - i; while (--diff != -1) { diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java index 12f35052f..d9f207a56 100644 --- a/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java @@ -39,8 +39,6 @@ import java.util.List; import java.util.ListIterator; -import junit.framework.Assert; - /** * Contains the list of currently playing songs, implements repeat and shuffle * support, and contains methods to fetch more songs from the MediaStore. @@ -565,7 +563,9 @@ private void reshuffleTimeline() */ public Song getSong(int delta) { - Assert.assertTrue(delta >= -1 && delta <= 1); + if(!(delta >= -1 && delta <= 1)) { + return null; + } ArrayList timeline = mSongs; Song song;