diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5713f7507..888f04c9b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -8,16 +8,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 17 java-package: jdk+fx + distribution: zulu - name: Build and test with gradle run: ./gradlew check developTest build - name: SonarCloud Scan - run: ./gradlew sonarqube -Dsonar.projectKey=mediathekview_MServer -Dsonar.organization=mediathekview -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN + run: ./gradlew sonar -Dsonar.projectKey=mediathekview_MServer -Dsonar.organization=mediathekview -Dsonar.host.url=https://sonarcloud.io env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 465d3a8af..62307648f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,12 +9,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 17 java-package: jdk+fx + distribution: zulu - name: Cache local Maven repository uses: actions/cache@v4 with: @@ -27,7 +28,7 @@ jobs: run: ./gradlew check developTest build - name: SonarCloud Scan - run: ./gradlew sonarqube -Dsonar.projectKey=mediathekview_MServer -Dsonar.organization=mediathekview -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN + run: ./gradlew sonar -Dsonar.projectKey=mediathekview_MServer -Dsonar.organization=mediathekview -Dsonar.host.url=https://sonarcloud.io env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -43,7 +44,7 @@ jobs: DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - name: Publish GitHub Release - uses: marvinpinto/action-automatic-releases@latest + uses: marvinpinto/action-automatic-releases@v1.2.3 with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "latest" @@ -51,4 +52,4 @@ jobs: files: | LICENSE.md build/libs/*.jar - build/distributions/* \ No newline at end of file + build/distributions/* diff --git a/build.gradle b/build.gradle index 6e1621a1f..8d2563554 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,8 @@ import java.nio.file.Files plugins { id 'application' id 'com.github.jk1.dependency-license-report' version "2.0" - id "org.sonarqube" version "3.4.0.2513" - id 'org.openjfx.javafxplugin' version '0.0.13' + id "org.sonarqube" version "7.3.0.8198" + id 'org.openjfx.javafxplugin' version '0.1.0' } repositories { @@ -22,11 +22,10 @@ javafx { version = "19" modules = [ 'javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.media' ] } - -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 group = 'de.mediathekview' -archivesBaseName = "MServer" +base { + archivesName = "MServer" +} version = '3.1.285' def jarName = 'MServer.jar' @@ -48,14 +47,13 @@ dependencies { implementation 'com.jidesoft:jide-oss:3.6.18' implementation 'com.squareup.okhttp3:okhttp:4.12.0' implementation 'com.fasterxml.jackson.core:jackson-core:2.15.0' - - - testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:4.11.0' testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0' - testImplementation "org.hamcrest:hamcrest-all:1.3" + testImplementation "org.hamcrest:hamcrest-junit:2.0.0.0" testImplementation 'org.assertj:assertj-core:3.23.1' - + testImplementation "org.hamcrest:hamcrest:2.2" + testImplementation "org.junit.jupiter:junit-jupiter:5.14.4" + testImplementation "org.junit.platform:junit-platform-launcher:1.14.4" } @@ -97,6 +95,7 @@ configurations { } test { + useJUnitPlatform() } task developTest(type: Test) { @@ -131,7 +130,8 @@ task performanceTest(type: Test) { } tasks.withType(Test) { - reports.html.destination = file("${reporting.baseDir}/${name}") + reports.html.outputLocation = layout.buildDirectory.dir("reports/${name}") + useJUnitPlatform() } ext { @@ -176,7 +176,7 @@ processResources.dependsOn generateLicenseReport [distZip, distTar]*.shouldRunAfter compileJava, updateVersion, jar distTar.compression = Compression.GZIP -distTar.extension = 'tar.gz' +distTar.archiveExtension = 'tar.gz' jar { manifest { @@ -185,7 +185,7 @@ jar { 'Class-Path': configurations.compileClasspath.files.collect { "lib/$it.name" }.join(' ') ) } - archiveName = jarName + archiveFileName = jarName } distributions { @@ -216,7 +216,7 @@ distributions { * This is how you pass arguments: "./gradlew start -Pargs=arg1,arg2,arg3 */ task start(type: JavaExec, dependsOn: classes) { - main = mainClass + mainClass = mainClass classpath = sourceSets.main.runtimeClasspath if (project.hasProperty('args')) { @@ -232,7 +232,7 @@ task start(type: JavaExec, dependsOn: classes) { * This is how you pass arguments: "./gradlew debug -Pargs=arg1,arg2,arg3 */ task debug(type: JavaExec, dependsOn: classes) { - main = mainClass + mainClass = mainClass classpath = sourceSets.main.runtimeClasspath debug true @@ -272,3 +272,8 @@ sonarqube { property "sonar.projectKey", "mediathekview_MServer" } } + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f..b1b8ef56b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee..3e94d5d2f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://downloads.gradle.org/distributions/gradle-9.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=bafc141b619ad6350fd975fc903156dd5c151998cc8b058e8c1044ab5f7b031f diff --git a/gradlew b/gradlew index a69d9cb6c..c66131609 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob//platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -133,22 +132,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -165,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -193,16 +198,19 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat old mode 100644 new mode 100755 index f127cfd49..24c62d56f --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -21,11 +23,12 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -42,13 +45,13 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -56,36 +59,24 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/src/test/developTest/java/de/mediathekview/mlib/daten/ListeFilmeTest.java b/src/test/developTest/java/de/mediathekview/mlib/daten/ListeFilmeTest.java index 4e7312d08..77bbeb4fe 100644 --- a/src/test/developTest/java/de/mediathekview/mlib/daten/ListeFilmeTest.java +++ b/src/test/developTest/java/de/mediathekview/mlib/daten/ListeFilmeTest.java @@ -1,11 +1,9 @@ package de.mediathekview.mlib.daten; import de.mediathekview.mlib.Const; -import de.mediathekview.mlib.daten.DatenFilm; -import de.mediathekview.mlib.daten.ListeFilme; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ListeFilmeTest { diff --git a/src/test/developTest/java/mServer/crawler/AddToFilmlistTest.java b/src/test/developTest/java/mServer/crawler/AddToFilmlistTest.java index f2b408966..48fd0c64e 100644 --- a/src/test/developTest/java/mServer/crawler/AddToFilmlistTest.java +++ b/src/test/developTest/java/mServer/crawler/AddToFilmlistTest.java @@ -2,7 +2,7 @@ import static jakarta.ws.rs.core.HttpHeaders.CONTENT_LENGTH; import static jakarta.ws.rs.core.HttpHeaders.CONTENT_TYPE; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import de.mediathekview.mlib.Const; import de.mediathekview.mlib.daten.DatenFilm; @@ -16,11 +16,10 @@ import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import org.assertj.core.api.Assertions; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; //FixMethodOrder(MethodSorters.NAME_ASCENDING) public class AddToFilmlistTest { @@ -46,7 +45,7 @@ public class AddToFilmlistTest { private ListeFilme list; private ListeFilme listToAdd; - @BeforeClass + @BeforeAll public static void setUpClass() throws IOException { mockServer = new MockWebServer(); Dispatcher dispatcher = new Dispatcher() { @@ -102,12 +101,12 @@ public MockResponse dispatch(RecordedRequest request) throws InterruptedExceptio baseUrl = mockServer.url("").toString(); } - @AfterClass + @AfterAll public static void teardownClass() throws IOException { - mockServer.shutdown(); + mockServer.close(); } - @Before + @BeforeEach public void setUp() { MserverDaten.system[MserverKonstanten.SYSTEM_BANNEDFILMLIST_NR] = "file:dist/bannedFilmList.txt"; listToAdd = new ListeFilme(); diff --git a/src/test/developTest/java/mServer/test/JsonFileReader.java b/src/test/developTest/java/mServer/test/JsonFileReader.java index 5b935ff49..b1b6f7b77 100644 --- a/src/test/developTest/java/mServer/test/JsonFileReader.java +++ b/src/test/developTest/java/mServer/test/JsonFileReader.java @@ -5,12 +5,13 @@ import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException; import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.fail; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import static org.junit.Assert.fail; /** * Reads a json file diff --git a/src/test/developTest/java/mServer/test/TestFileReader.java b/src/test/developTest/java/mServer/test/TestFileReader.java index ec91ff2bc..741fa1145 100644 --- a/src/test/developTest/java/mServer/test/TestFileReader.java +++ b/src/test/developTest/java/mServer/test/TestFileReader.java @@ -6,7 +6,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import static org.junit.Assert.fail; + +import static org.junit.jupiter.api.Assertions.fail; public class TestFileReader { private TestFileReader() {} diff --git a/src/test/developTest/java/mServer/tool/HashFileWriterTest.java b/src/test/developTest/java/mServer/tool/HashFileWriterTest.java index 7283bdf5c..73022dda8 100644 --- a/src/test/developTest/java/mServer/tool/HashFileWriterTest.java +++ b/src/test/developTest/java/mServer/tool/HashFileWriterTest.java @@ -8,9 +8,10 @@ import java.time.OffsetDateTime; import org.hamcrest.Matchers; -import org.junit.After; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; public class HashFileWriterTest { private static final String FILE_NAME_FILMLISTE_HASH = "filmliste.id"; @@ -21,12 +22,12 @@ public class HashFileWriterTest { public void testWriteHash() throws IOException { String id = OffsetDateTime.now().toInstant().toString(); new HashFileWriter(basePath.toString()).writeHash(id); - Assert.assertThat("Das schreiben der Test Filmlisten ID hat nicht geklappt.", + assertThat("Das schreiben der Test Filmlisten ID hat nicht geklappt.", Files.readAllLines(basePath.resolve(FILE_NAME_FILMLISTE_HASH), StandardCharsets.UTF_8).get(0), Matchers.equalTo(id)); } - @After + @AfterEach public void deleteIfExist() throws IOException { Path filmlistIdPath = basePath.resolve(FILE_NAME_FILMLISTE_HASH); if (Files.exists(filmlistIdPath)) { diff --git a/src/test/developTest/java/mServer/tool/M3U8UtilsTest.java b/src/test/developTest/java/mServer/tool/M3U8UtilsTest.java index d3b8e7af3..d7aa8f08d 100644 --- a/src/test/developTest/java/mServer/tool/M3U8UtilsTest.java +++ b/src/test/developTest/java/mServer/tool/M3U8UtilsTest.java @@ -3,11 +3,11 @@ import java.util.Map; import org.hamcrest.CoreMatchers; -import org.junit.Assert; -import org.junit.Test; - +import org.junit.jupiter.api.Test; import mServer.crawler.sender.base.Qualities; +import static org.hamcrest.MatcherAssert.assertThat; + /** * A test class for the util class {@link M3U8Utils}. */ @@ -33,9 +33,9 @@ public class M3U8UtilsTest public void testGatherUrlsFromWDRM3U8_MoreThenThree_Positiv() { Map qualitiesAndUrls = M3U8Utils.gatherUrlsFromWdrM3U8(TEST_URL_POSITIV_MORE_THEN_THREE_ELEMENTS); - Assert.assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); - Assert.assertThat(qualitiesAndUrls.get(Qualities.NORMAL), CoreMatchers.is(AWAITED_URL_NORMAL)); - Assert.assertThat(qualitiesAndUrls.get(Qualities.HD), CoreMatchers.is(AWAITED_URL_HD)); + assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); + assertThat(qualitiesAndUrls.get(Qualities.NORMAL), CoreMatchers.is(AWAITED_URL_NORMAL)); + assertThat(qualitiesAndUrls.get(Qualities.HD), CoreMatchers.is(AWAITED_URL_HD)); } /** @@ -45,9 +45,9 @@ public void testGatherUrlsFromWDRM3U8_MoreThenThree_Positiv() public void testGatherUrlsFromWDRM3U8_ExactThree_Positiv() { Map qualitiesAndUrls = M3U8Utils.gatherUrlsFromWdrM3U8(TEST_URL_POSITIV_THREE_ELEMENTS); - Assert.assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); - Assert.assertThat(qualitiesAndUrls.get(Qualities.NORMAL), CoreMatchers.is(AWAITED_URL_NORMAL)); - Assert.assertThat(qualitiesAndUrls.get(Qualities.HD), CoreMatchers.is(AWAITED_URL_HD)); + assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); + assertThat(qualitiesAndUrls.get(Qualities.NORMAL), CoreMatchers.is(AWAITED_URL_NORMAL)); + assertThat(qualitiesAndUrls.get(Qualities.HD), CoreMatchers.is(AWAITED_URL_HD)); } /** @@ -57,8 +57,8 @@ public void testGatherUrlsFromWDRM3U8_ExactThree_Positiv() public void testGatherUrlsFromWDRM3U8_ExactTwo_Positiv() { Map qualitiesAndUrls = M3U8Utils.gatherUrlsFromWdrM3U8(TEST_URL_POSITIV_TWO_ELEMENTS); - Assert.assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); - Assert.assertThat(qualitiesAndUrls.get(Qualities.NORMAL), CoreMatchers.is(AWAITED_URL_NORMAL)); + assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); + assertThat(qualitiesAndUrls.get(Qualities.NORMAL), CoreMatchers.is(AWAITED_URL_NORMAL)); } /** @@ -68,7 +68,7 @@ public void testGatherUrlsFromWDRM3U8_ExactTwo_Positiv() public void testGatherUrlsFromWDRM3U8_ExactOne_Positiv() { Map qualitiesAndUrls = M3U8Utils.gatherUrlsFromWdrM3U8(TEST_URL_POSITIV_ONE_ELEMENT); - Assert.assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); + assertThat(qualitiesAndUrls.get(Qualities.SMALL), CoreMatchers.is(AWAITED_URL_SMALL)); } /** @@ -78,7 +78,7 @@ public void testGatherUrlsFromWDRM3U8_ExactOne_Positiv() public void testGatherUrlsFromWDRM3U8_NoneElement_Negativ() { Map qualitiesAndUrls = M3U8Utils.gatherUrlsFromWdrM3U8(TEST_URL_NEGATIV_NONE_ELEMENT); - Assert.assertThat(qualitiesAndUrls.isEmpty(), CoreMatchers.is(true)); + assertThat(qualitiesAndUrls.isEmpty(), CoreMatchers.is(true)); } /** @@ -88,6 +88,6 @@ public void testGatherUrlsFromWDRM3U8_NoneElement_Negativ() public void testGatherUrlsFromWDRM3U8_WrongUrl_Negativ() { Map qualitiesAndUrls = M3U8Utils.gatherUrlsFromWdrM3U8(TEST_URL_NEGATIV_WRONG_URL); - Assert.assertThat(qualitiesAndUrls.isEmpty(), CoreMatchers.is(true)); + assertThat(qualitiesAndUrls.isEmpty(), CoreMatchers.is(true)); } } diff --git a/src/test/performanceTest/java/PerformanceTest.java b/src/test/performanceTest/java/PerformanceTest.java index 1544f9f4b..e9785f1a7 100644 --- a/src/test/performanceTest/java/PerformanceTest.java +++ b/src/test/performanceTest/java/PerformanceTest.java @@ -3,9 +3,9 @@ import etm.core.monitor.EtmMonitor; import etm.core.renderer.SimpleTextRenderer; import mServer.Main; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.net.URISyntaxException; import java.nio.file.Path; @@ -20,7 +20,7 @@ public class PerformanceTest private EtmMonitor performanceMonitor; private Path testConfigPath; - @Before + @BeforeEach public void setUp() throws URISyntaxException { BasicEtmConfigurator.configure(); @@ -30,7 +30,7 @@ public void setUp() throws URISyntaxException testConfigPath = Paths.get(getClass().getResource(TEST_REOSURCES_FOLDERPATH).toURI()); } - @After + @AfterEach public void tearDown() { performanceMonitor.stop();