mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-09 11:43:01 +00:00
code cleanup
mainly removes throw statements automated using Android Studio, staged by hand BUILD SUCCESSFUL in 52s 39 actionable tasks: 37 executed, 2 up-to-date
This commit is contained in:
@@ -27,7 +27,7 @@ public class ImportExportJsonHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidSource() throws Exception {
|
||||
public void testInvalidSource() {
|
||||
List<String> invalidList = Arrays.asList(
|
||||
"{}",
|
||||
"",
|
||||
|
||||
@@ -15,7 +15,7 @@ import static org.junit.Assert.assertNull;
|
||||
*/
|
||||
public class ErrorActivityTest {
|
||||
@Test
|
||||
public void getReturnActivity() throws Exception {
|
||||
public void getReturnActivity() {
|
||||
Class<? extends Activity> returnActivity;
|
||||
returnActivity = ErrorActivity.getReturnActivity(MainActivity.class);
|
||||
assertEquals(MainActivity.class, returnActivity);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ListHelperTest {
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "1080p60", true));
|
||||
|
||||
@Test
|
||||
public void getSortedStreamVideosListTest() throws Exception {
|
||||
public void getSortedStreamVideosListTest() {
|
||||
List<VideoStream> result = ListHelper.getSortedStreamVideosList(MediaFormat.MPEG_4, true, videoStreamsTestList, videoOnlyStreamsTestList, true);
|
||||
|
||||
List<String> expected = Arrays.asList("144p", "240p", "360p", "480p", "720p", "720p60", "1080p", "1080p60", "1440p60", "2160p", "2160p60");
|
||||
@@ -67,7 +67,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSortedStreamVideosExceptHighResolutionsTest() throws Exception {
|
||||
public void getSortedStreamVideosExceptHighResolutionsTest() {
|
||||
////////////////////////////////////
|
||||
// Don't show Higher resolutions //
|
||||
//////////////////////////////////
|
||||
@@ -79,7 +79,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDefaultResolutionTest() throws Exception {
|
||||
public void getDefaultResolutionTest() {
|
||||
List<VideoStream> testList = Arrays.asList(
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "720p"),
|
||||
new VideoStream("", MediaFormat.v3GPP, /**/ "240p"),
|
||||
@@ -130,7 +130,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighestQualityAudioFormatTest() throws Exception {
|
||||
public void getHighestQualityAudioFormatTest() {
|
||||
AudioStream stream = audioStreamsTestList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.M4A, audioStreamsTestList));
|
||||
assertEquals(320, stream.average_bitrate);
|
||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||
@@ -145,7 +145,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighestQualityAudioFormatPreferredAbsent() throws Exception {
|
||||
public void getHighestQualityAudioFormatPreferredAbsent() {
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Doesn't contain the preferred format //
|
||||
@@ -186,13 +186,13 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getHighestQualityAudioNull() throws Exception {
|
||||
public void getHighestQualityAudioNull() {
|
||||
assertEquals(-1, ListHelper.getHighestQualityAudioIndex(null, null));
|
||||
assertEquals(-1, ListHelper.getHighestQualityAudioIndex(null, new ArrayList<AudioStream>()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLowestQualityAudioFormatTest() throws Exception {
|
||||
public void getLowestQualityAudioFormatTest() {
|
||||
AudioStream stream = audioStreamsTestList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.M4A, audioStreamsTestList));
|
||||
assertEquals(128, stream.average_bitrate);
|
||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||
@@ -207,7 +207,7 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLowestQualityAudioFormatPreferredAbsent() throws Exception {
|
||||
public void getLowestQualityAudioFormatPreferredAbsent() {
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Doesn't contain the preferred format //
|
||||
@@ -250,13 +250,13 @@ public class ListHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLowestQualityAudioNull() throws Exception {
|
||||
public void getLowestQualityAudioNull() {
|
||||
assertEquals(-1, ListHelper.getMostCompactAudioIndex(null, null));
|
||||
assertEquals(-1, ListHelper.getMostCompactAudioIndex(null, new ArrayList<AudioStream>()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getVideoDefaultStreamIndexCombinations() throws Exception {
|
||||
public void getVideoDefaultStreamIndexCombinations() {
|
||||
List<VideoStream> testList = Arrays.asList(
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "1080p"),
|
||||
new VideoStream("", MediaFormat.MPEG_4, /**/ "720p60"),
|
||||
|
||||
@@ -11,25 +11,25 @@ public class QuadraticSliderStrategyTest {
|
||||
private final SliderStrategy.Quadratic standard =
|
||||
new SliderStrategy.Quadratic(0f, 100f, 50f, STEP);
|
||||
@Test
|
||||
public void testLeftBound() throws Exception {
|
||||
public void testLeftBound() {
|
||||
assertEquals(standard.progressOf(0), 0);
|
||||
assertEquals(standard.valueOf(0), 0f, DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCenter() throws Exception {
|
||||
public void testCenter() {
|
||||
assertEquals(standard.progressOf(50), 50);
|
||||
assertEquals(standard.valueOf(50), 50f, DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRightBound() throws Exception {
|
||||
public void testRightBound() {
|
||||
assertEquals(standard.progressOf(100), 100);
|
||||
assertEquals(standard.valueOf(100), 100f, DELTA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLeftRegion() throws Exception {
|
||||
public void testLeftRegion() {
|
||||
final int leftProgress = standard.progressOf(25);
|
||||
final double leftValue = standard.valueOf(25);
|
||||
assertTrue(leftProgress > 0 && leftProgress < 50);
|
||||
@@ -37,7 +37,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRightRegion() throws Exception {
|
||||
public void testRightRegion() {
|
||||
final int leftProgress = standard.progressOf(75);
|
||||
final double leftValue = standard.valueOf(75);
|
||||
assertTrue(leftProgress > 50 && leftProgress < 100);
|
||||
@@ -45,7 +45,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConversion() throws Exception {
|
||||
public void testConversion() {
|
||||
assertEquals(standard.progressOf(standard.valueOf(0)), 0);
|
||||
assertEquals(standard.progressOf(standard.valueOf(25)), 25);
|
||||
assertEquals(standard.progressOf(standard.valueOf(50)), 50);
|
||||
@@ -54,7 +54,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReverseConversion() throws Exception {
|
||||
public void testReverseConversion() {
|
||||
// Need a larger delta since step size / granularity is too small and causes
|
||||
// floating point round-off errors during conversion
|
||||
final float largeDelta = 1f;
|
||||
@@ -67,7 +67,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuadraticPropertyLeftRegion() throws Exception {
|
||||
public void testQuadraticPropertyLeftRegion() {
|
||||
final double differenceCloserToCenter =
|
||||
Math.abs(standard.valueOf(40) - standard.valueOf(45));
|
||||
final double differenceFurtherFromCenter =
|
||||
@@ -76,7 +76,7 @@ public class QuadraticSliderStrategyTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuadraticPropertyRightRegion() throws Exception {
|
||||
public void testQuadraticPropertyRightRegion() {
|
||||
final double differenceCloserToCenter =
|
||||
Math.abs(standard.valueOf(75) - standard.valueOf(70));
|
||||
final double differenceFurtherFromCenter =
|
||||
|
||||
@@ -110,7 +110,7 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resumeMission() throws Exception {
|
||||
public void resumeMission() {
|
||||
DownloadMission mission = missions.get(0);
|
||||
mission.running = true;
|
||||
verify(mission, never()).start();
|
||||
@@ -122,7 +122,7 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pauseMission() throws Exception {
|
||||
public void pauseMission() {
|
||||
DownloadMission mission = missions.get(0);
|
||||
mission.running = false;
|
||||
downloadManager.pauseMission(0);
|
||||
@@ -133,7 +133,7 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteMission() throws Exception {
|
||||
public void deleteMission() {
|
||||
DownloadMission mission = missions.get(0);
|
||||
assertEquals(mission, downloadManager.getMission(0));
|
||||
downloadManager.deleteMission(0);
|
||||
@@ -143,18 +143,18 @@ public class DownloadManagerImplTest {
|
||||
}
|
||||
|
||||
@Test(expected = RuntimeException.class)
|
||||
public void getMissionWithNegativeIndex() throws Exception {
|
||||
public void getMissionWithNegativeIndex() {
|
||||
downloadManager.getMission(-1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMission() throws Exception {
|
||||
public void getMission() {
|
||||
assertSame(missions.get(0), downloadManager.getMission(0));
|
||||
assertSame(missions.get(1), downloadManager.getMission(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sortByTimestamp() throws Exception {
|
||||
public void sortByTimestamp() {
|
||||
ArrayList<DownloadMission> downloadMissions = new ArrayList<>();
|
||||
DownloadMission mission = new DownloadMission();
|
||||
mission.timestamp = 0;
|
||||
|
||||
Reference in New Issue
Block a user