From 5b72d18edd20c488568d8055542568cb128b46c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 9 Nov 2024 20:15:29 +0100 Subject: [PATCH] =?utf8?q?=E2=AC=86=EF=B8=8F=20Update=20to=20JUnit=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++- .../net/pterodactylus/rhynodge/ReactionTest.java | 4 +-- .../rhynodge/actions/EmailActionTest.java | 3 +- .../rhynodge/filters/BlacklistFilterTest.java | 3 +- .../rhynodge/filters/ComicSiteFilterTest.java | 11 ++++---- .../rhynodge/filters/EpisodeFilterTest.java | 8 +++--- .../rhynodge/filters/JsonFilterTest.kt | 8 ++---- .../comics/AbstruseGooseComicFilterTest.java | 2 +- .../comics/CyanideAndHappinessComicFilterTest.java | 2 +- .../filters/comics/GirlGeniusComicFilterTest.java | 2 +- .../ScandinaviaAndTheWorldComicFilterTest.java | 2 +- .../torrents/KickAssTorrentsFilterTest.java | 2 +- .../filters/torrents/PirateBayFilterTest.java | 2 +- .../filters/torrents/TorrentHoundFilterTest.java | 2 +- .../filters/torrents/TorrentzEuFilterTest.java | 2 +- .../rhynodge/states/StateManagerTest.java | 32 ++++++++++------------ .../net/pterodactylus/util/envopt/ParserTest.java | 9 +++--- .../util/envopt/SystemEnvironmentTest.java | 2 +- .../util/inject/ObjectBindingTest.java | 2 +- .../rhynodge/engine/ReactionRunnerTest.kt | 2 +- .../rhynodge/filters/SizeBlacklistFilterTest.kt | 7 ++--- .../filters/comics/BusinessCatComicFilterTest.kt | 2 +- .../comics/ChiefOBrienAtWorkComicFilterTest.kt | 2 +- .../rhynodge/filters/comics/ComicSiteFilterTest.kt | 2 +- .../filters/comics/CtrlAltDelComicFilterTest.kt | 2 +- .../filters/comics/DrugsAndWiresComicFilterTest.kt | 2 +- .../filters/comics/HeldentageFilterTest.kt | 2 +- .../filters/comics/LeastICouldDoComicFilterTest.kt | 2 +- .../comics/PoorlyDrawnLinesComicFilterTest.kt | 2 +- .../comics/QuestionableContentFilterTest.kt | 2 +- ...aturdayMorningBreakfastCerealComicFilterTest.kt | 2 +- .../filters/comics/SinfestComicFilterTest.kt | 2 +- .../comics/SoggyCardboardComicFilterTest.kt | 2 +- .../comics/TheMonsterUnderTheBedFilterTest.kt | 14 ++++++---- .../webpages/epicgames/EpicGamesFilterTest.kt | 6 ++-- .../webpages/epicgames/EpicGamesMergerTest.kt | 8 +++--- .../webpages/epicgames/FreeGamesStateTest.kt | 2 +- .../filters/webpages/savoy/MovieExtractorTest.kt | 2 +- .../filters/webpages/savoy/MovieStateTest.kt | 2 +- .../filters/webpages/savoy/SavoyMergerTest.kt | 8 +++--- .../rhynodge/mergers/ComicMergerTest.kt | 2 +- .../rhynodge/mergers/LastStateMergerTest.kt | 2 +- .../rhynodge/queries/FallbackQueryTest.kt | 11 ++------ .../rhynodge/states/AbstractStateTest.kt | 2 +- .../pterodactylus/rhynodge/states/JsonStateTest.kt | 2 +- .../pterodactylus/util/exception/ExceptionsTest.kt | 2 +- 46 files changed, 95 insertions(+), 103 deletions(-) diff --git a/build.gradle b/build.gradle index 00dfc77..bd7bd42 100644 --- a/build.gradle +++ b/build.gradle @@ -58,7 +58,8 @@ dependencies { implementation group: "org.jetbrains.kotlinx", name: "kotlinx-html-jvm", version: "0.11.0" implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' - testImplementation group: "junit", name: "junit", version: "4.13.2" + testImplementation(platform("org.junit:junit-bom:5.11.3")) + testImplementation group: "org.junit.jupiter", name: "junit-jupiter-engine" testImplementation group: "org.hamcrest", name: "hamcrest", version: "2.2" testImplementation group: "org.mockito", name: "mockito-core", version: "5.11.0" testImplementation group: "com.spotify", name: "hamcrest-jackson", version: "1.3.2" @@ -79,6 +80,7 @@ tasks.register('fatJar', Jar) { } tasks.named('test') { + useJUnitPlatform() jvmArgs += "--add-opens=java.base/java.lang=ALL-UNNAMED" jvmArgs += "--add-opens=java.base/java.util=ALL-UNNAMED" } diff --git a/src/test/java/net/pterodactylus/rhynodge/ReactionTest.java b/src/test/java/net/pterodactylus/rhynodge/ReactionTest.java index c30013f..efb782e 100644 --- a/src/test/java/net/pterodactylus/rhynodge/ReactionTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/ReactionTest.java @@ -1,5 +1,7 @@ package net.pterodactylus.rhynodge; +import org.junit.jupiter.api.Test; + import static java.util.Arrays.asList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; @@ -7,8 +9,6 @@ import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; -import org.junit.Test; - /** * Unit test for {@link Reaction}. * diff --git a/src/test/java/net/pterodactylus/rhynodge/actions/EmailActionTest.java b/src/test/java/net/pterodactylus/rhynodge/actions/EmailActionTest.java index a4dbb16..9fe5688 100644 --- a/src/test/java/net/pterodactylus/rhynodge/actions/EmailActionTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/actions/EmailActionTest.java @@ -13,8 +13,7 @@ import javax.mail.Transport; import net.pterodactylus.rhynodge.output.DefaultOutput; import net.pterodactylus.rhynodge.output.Output; - -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link EmailAction}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/BlacklistFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/BlacklistFilterTest.java index ed8e3a3..1e54d72 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/BlacklistFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/BlacklistFilterTest.java @@ -28,8 +28,7 @@ import net.pterodactylus.rhynodge.State; import net.pterodactylus.rhynodge.states.FailedState; import net.pterodactylus.rhynodge.states.TorrentState; import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile; - -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link BlacklistFilter}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/ComicSiteFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/ComicSiteFilterTest.java index deff04a..01c3f06 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/ComicSiteFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/ComicSiteFilterTest.java @@ -6,6 +6,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.util.Collections; import java.util.List; @@ -19,7 +20,7 @@ import net.pterodactylus.rhynodge.states.HtmlState; import com.google.common.base.Optional; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link ComicSiteFilter}. @@ -28,11 +29,11 @@ import org.junit.Test; */ public class ComicSiteFilterTest { - @Test(expected = IllegalArgumentException.class) + @Test public void comicSiteFilterRequiresHtmlState() { State state = new FailedState(); ComicSiteFilter comicSiteFilter = new TestComicSiteFilter(null, null, null); - comicSiteFilter.filter(state); + assertThrows(IllegalArgumentException.class, () -> comicSiteFilter.filter(state)); } @Test @@ -55,11 +56,11 @@ public class ComicSiteFilterTest { assertThat(comic.strips(), contains(new Strip("http://foo/url1.gif", "Comment 1"), new Strip("http://foo/url2.gif", "Comment 2"), new Strip("http://foo/url3.gif", ""))); } - @Test(expected = IllegalStateException.class) + @Test public void illegalUrlThrowsException() { State state = new HtmlState("http://foo/^", null); ComicSiteFilter comicSiteFilter = new TestComicSiteFilter("Title", asList("url1.gif"), Collections.emptyList()); - comicSiteFilter.filter(state); + assertThrows(IllegalStateException.class, () -> comicSiteFilter.filter(state)); } private static class TestComicSiteFilter extends ComicSiteFilter { diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/EpisodeFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/EpisodeFilterTest.java index 109e053..f2813e2 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/EpisodeFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/EpisodeFilterTest.java @@ -2,6 +2,7 @@ package net.pterodactylus.rhynodge.filters; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertThrows; import net.pterodactylus.rhynodge.State; import net.pterodactylus.rhynodge.states.EpisodeState; @@ -9,8 +10,7 @@ import net.pterodactylus.rhynodge.states.FailedState; import net.pterodactylus.rhynodge.states.HtmlState; import net.pterodactylus.rhynodge.states.TorrentState; import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile; - -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link EpisodeFilter}. @@ -28,10 +28,10 @@ public class EpisodeFilterTest { assertThat(newState.success(), is(false)); } - @Test(expected = IllegalStateException.class) + @Test public void episodeFilterRequiresATorrentState() { State state = new HtmlState("http://foo/", null); - episodeFilter.filter(state); + assertThrows(IllegalStateException.class, () -> episodeFilter.filter(state)); } @Test diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/JsonFilterTest.kt b/src/test/java/net/pterodactylus/rhynodge/filters/JsonFilterTest.kt index a37990a..7e0f3ba 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/JsonFilterTest.kt +++ b/src/test/java/net/pterodactylus/rhynodge/filters/JsonFilterTest.kt @@ -6,7 +6,6 @@ import com.spotify.hamcrest.jackson.JsonMatchers.jsonNull import com.spotify.hamcrest.jackson.JsonMatchers.jsonObject import com.spotify.hamcrest.jackson.JsonMatchers.jsonText import net.pterodactylus.rhynodge.Filter -import net.pterodactylus.rhynodge.states.AbstractState import net.pterodactylus.rhynodge.states.FailedState import net.pterodactylus.rhynodge.states.HttpState import net.pterodactylus.rhynodge.states.JsonState @@ -14,9 +13,8 @@ import net.pterodactylus.rhynodge.states.StringState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.instanceOf -import org.junit.Assert -import org.junit.Assert.assertThrows -import org.junit.Test +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows class JsonFilterTest { @@ -58,7 +56,7 @@ class JsonFilterTest { @Test fun `json filter throws exception if given state is not an http state`() { - assertThrows(IllegalArgumentException::class.java) { filter.filter(StringState("foo")) } + assertThrows { filter.filter(StringState("foo")) } } @Test diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java index f01e841..16be464 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/AbstruseGooseComicFilterTest.java @@ -29,7 +29,7 @@ import net.pterodactylus.rhynodge.filters.ResourceLoader; import com.google.common.base.Optional; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link AbstruseGooseComicFilter}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java index bea429a..0b24697 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/CyanideAndHappinessComicFilterTest.java @@ -10,7 +10,7 @@ import net.pterodactylus.rhynodge.states.ComicState; import net.pterodactylus.rhynodge.states.HtmlState; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link CyanideAndHappinessComicFilter}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilterTest.java index a45f075..46b76d0 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilterTest.java @@ -11,7 +11,7 @@ import net.pterodactylus.rhynodge.states.ComicState; import net.pterodactylus.rhynodge.states.HtmlState; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link GirlGeniusComicFilterTest}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/ScandinaviaAndTheWorldComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/ScandinaviaAndTheWorldComicFilterTest.java index 53461cb..8168539 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/ScandinaviaAndTheWorldComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/ScandinaviaAndTheWorldComicFilterTest.java @@ -17,7 +17,7 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link ScandinaviaAndTheWorldComicFilterTest}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java index 73657bc..be2bfa9 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/KickAssTorrentsFilterTest.java @@ -12,7 +12,7 @@ import org.hamcrest.TypeSafeDiagnosingMatcher; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link KickAssTorrentsFilter}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/PirateBayFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/PirateBayFilterTest.java index 11f7019..f95ffb7 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/PirateBayFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/PirateBayFilterTest.java @@ -11,7 +11,7 @@ import net.pterodactylus.rhynodge.states.TorrentState; import org.hamcrest.Matchers; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link PirateBayFilter}. diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentHoundFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentHoundFilterTest.java index 499999b..51feb42 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentHoundFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentHoundFilterTest.java @@ -10,7 +10,7 @@ import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * @author David ‘Bombe’ Roden diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentzEuFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentzEuFilterTest.java index d7afc94..1d65308 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentzEuFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/torrents/TorrentzEuFilterTest.java @@ -10,7 +10,7 @@ import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link TorrentzEuFilter}. diff --git a/src/test/java/net/pterodactylus/rhynodge/states/StateManagerTest.java b/src/test/java/net/pterodactylus/rhynodge/states/StateManagerTest.java index da1bb90..639c8f7 100644 --- a/src/test/java/net/pterodactylus/rhynodge/states/StateManagerTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/states/StateManagerTest.java @@ -11,13 +11,12 @@ import net.pterodactylus.rhynodge.states.StateManager.StateDirectory; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.io.Files; import org.hamcrest.Matchers; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import static com.google.common.base.Charsets.UTF_8; -import static com.google.common.base.Objects.equal; import static org.apache.log4j.Level.OFF; import static org.apache.log4j.Logger.getLogger; import static org.hamcrest.MatcherAssert.assertThat; @@ -30,24 +29,21 @@ import static org.hamcrest.Matchers.is; */ public class StateManagerTest { - @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); - private final File statePath; - private final StateManager stateManager; + @TempDir private File tempFolder; + private StateManager stateManager; - @BeforeClass + @BeforeAll public static void deactivateLogging() { getLogger(StateManager.class).setLevel(OFF); } - public StateManagerTest() throws IOException { - tempFolder.create(); - statePath = tempFolder.newFolder(); - stateManager = new StateManager(StateDirectory.of(statePath.getPath())); + @BeforeEach + public void createStateManager() { + stateManager = new StateManager(StateDirectory.of(tempFolder.getPath())); } @Test - public void successStateCanBeRestored() { + public void successStateCanBeRestored(@TempDir File tempDir) throws IOException { TestState testState = new TestState(); stateManager.saveState("test", testState); Optional restoredState = stateManager.loadLastState("test"); @@ -68,14 +64,14 @@ public class StateManagerTest { @Test public void invalidJsonFileCanNotBeLoaded() throws IOException { - Files.write("not json", new File(statePath, "test.last.json"), UTF_8); + Files.write("not json", new File(tempFolder, "test.last.json"), UTF_8); Optional restoredState = stateManager.loadLastState("test"); assertThat(restoredState.isPresent(), is(false)); } @Test public void jsonWithInvalidFieldsCanNotBeLoaded() throws IOException { - Files.write("{\"not\":\"json\"}", new File(statePath, "test.last.json"), UTF_8); + Files.write("{\"not\":\"json\"}", new File(tempFolder, "test.last.json"), UTF_8); Optional restoredState = stateManager.loadLastState("test"); assertThat(restoredState.isPresent(), is(false)); } @@ -84,7 +80,7 @@ public class StateManagerTest { public void unmappableStateCanBeSavedButNotLoaded() throws IOException { InvalidState invalidState = new InvalidState(); stateManager.saveState("test", invalidState); - assertThat(new File(statePath, "test.last.json").exists(), is(false)); + assertThat(new File(tempFolder, "test.last.json").exists(), is(false)); } public static class TestState extends AbstractState { diff --git a/src/test/java/net/pterodactylus/util/envopt/ParserTest.java b/src/test/java/net/pterodactylus/util/envopt/ParserTest.java index 5014b9d..0835fd4 100644 --- a/src/test/java/net/pterodactylus/util/envopt/ParserTest.java +++ b/src/test/java/net/pterodactylus/util/envopt/ParserTest.java @@ -6,9 +6,11 @@ import net.pterodactylus.util.envopt.Parser.RequiredOptionIsMissing; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import static org.junit.jupiter.api.Assertions.assertThrows; + /** * Unit test for {@link Parser}. * @@ -39,11 +41,10 @@ public class ParserTest { MatcherAssert.assertThat(finalTestOptions.getOptionOne(), Matchers.is("test")); } - @Test(expected = RequiredOptionIsMissing.class) + @Test public void parserThrowsIfRequiredOptionIsMissing() { Mockito.when(environment.getValue("foo")).thenReturn(Optional.empty()); - RequiredTestOptions requiredTestOptions = parser.parseEnvironment(RequiredTestOptions::new); - requiredTestOptions.getOptionOne(); + assertThrows(RequiredOptionIsMissing.class, () -> parser.parseEnvironment(RequiredTestOptions::new)); } @Test diff --git a/src/test/java/net/pterodactylus/util/envopt/SystemEnvironmentTest.java b/src/test/java/net/pterodactylus/util/envopt/SystemEnvironmentTest.java index ac9fe52..c21bba8 100644 --- a/src/test/java/net/pterodactylus/util/envopt/SystemEnvironmentTest.java +++ b/src/test/java/net/pterodactylus/util/envopt/SystemEnvironmentTest.java @@ -6,7 +6,7 @@ import java.util.Optional; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link SystemEnvironment}. diff --git a/src/test/java/net/pterodactylus/util/inject/ObjectBindingTest.java b/src/test/java/net/pterodactylus/util/inject/ObjectBindingTest.java index df32585..273430a 100644 --- a/src/test/java/net/pterodactylus/util/inject/ObjectBindingTest.java +++ b/src/test/java/net/pterodactylus/util/inject/ObjectBindingTest.java @@ -4,7 +4,7 @@ import com.google.inject.Guice; import com.google.inject.Injector; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit test for {@link ObjectBinding}. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/engine/ReactionRunnerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/engine/ReactionRunnerTest.kt index 4dfd891..a7b6ddc 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/engine/ReactionRunnerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/engine/ReactionRunnerTest.kt @@ -13,7 +13,7 @@ import org.hamcrest.Matcher import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.hamcrest.TypeSafeDiagnosingMatcher -import org.junit.Test +import org.junit.jupiter.api.Test import java.util.Optional import java.util.Optional.empty import java.util.Optional.of diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/SizeBlacklistFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/SizeBlacklistFilterTest.kt index 4ab5430..393dc77 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/SizeBlacklistFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/SizeBlacklistFilterTest.kt @@ -3,11 +3,10 @@ package net.pterodactylus.rhynodge.filters import net.pterodactylus.rhynodge.states.FailedState import net.pterodactylus.rhynodge.states.TorrentState import net.pterodactylus.rhynodge.states.TorrentState.TorrentFile -import org.hamcrest.MatcherAssert import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers +import org.hamcrest.Matchers.containsInAnyOrder import org.hamcrest.Matchers.equalTo -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [SizeBlacklistFilter]. @@ -28,7 +27,7 @@ class SizeBlacklistFilterTest { matchingTorrentFile1, matchingTorrentFile2 ))) as TorrentState - assertThat(filteredState.torrentFiles(), Matchers.containsInAnyOrder( + assertThat(filteredState.torrentFiles(), containsInAnyOrder( notMatchingTorrentFile1, notMatchingTorrentFile2 )) diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.kt index df7bd8f..1956c82 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.kt @@ -5,7 +5,7 @@ import net.pterodactylus.rhynodge.states.ComicState import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [BusinessCatComicFilter]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt index d5a44b8..f252803 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt @@ -7,7 +7,7 @@ import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.empty import org.hamcrest.Matchers.equalTo import org.jsoup.nodes.Document -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [ChiefOBrienAtWorkComicFilter]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ComicSiteFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ComicSiteFilterTest.kt index ce1a8e2..71f987d 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ComicSiteFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ComicSiteFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Comic import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo -import org.junit.Test +import org.junit.jupiter.api.Test abstract class ComicSiteFilterTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/CtrlAltDelComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/CtrlAltDelComicFilterTest.kt index e9817ed..d53e149 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/CtrlAltDelComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/CtrlAltDelComicFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Strip import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [CtrlAltDelComicFilter]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/DrugsAndWiresComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/DrugsAndWiresComicFilterTest.kt index 1357209..3003434 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/DrugsAndWiresComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/DrugsAndWiresComicFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Strip import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test class DrugsAndWiresComicFilterTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt index 8443a9d..0b39555 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/HeldentageFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Comic import net.pterodactylus.rhynodge.states.ComicState.Strip import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [HeldentageFilter]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/LeastICouldDoComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/LeastICouldDoComicFilterTest.kt index 0d88973..a8fc14e 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/LeastICouldDoComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/LeastICouldDoComicFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Strip import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [LeastICouldDoComicFilterTest]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/PoorlyDrawnLinesComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/PoorlyDrawnLinesComicFilterTest.kt index 4d31c13..5ae542f 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/PoorlyDrawnLinesComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/PoorlyDrawnLinesComicFilterTest.kt @@ -6,7 +6,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Strip import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test class PoorlyDrawnLinesComicFilterTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/QuestionableContentFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/QuestionableContentFilterTest.kt index 39ae500..ba28c4c 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/QuestionableContentFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/QuestionableContentFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Strip import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test class QuestionableContentFilterTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.kt index 45e97bf..35df42b 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.kt @@ -5,7 +5,7 @@ import net.pterodactylus.rhynodge.states.ComicState import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.* -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [SaturdayMorningBreakfastCerealComicFilter]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilterTest.kt index 92049ba..31084cf 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilterTest.kt @@ -9,7 +9,7 @@ import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.instanceOf -import org.junit.Test +import org.junit.jupiter.api.Test /** * Unit test for [SinfestComicFilter]. diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SoggyCardboardComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SoggyCardboardComicFilterTest.kt index b11f4eb..a18901e 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SoggyCardboardComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/SoggyCardboardComicFilterTest.kt @@ -7,7 +7,7 @@ import net.pterodactylus.rhynodge.states.ComicState.Strip import net.pterodactylus.rhynodge.states.HtmlState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test class SoggyCardboardComicFilterTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/TheMonsterUnderTheBedFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/TheMonsterUnderTheBedFilterTest.kt index df159c5..1495c5e 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/TheMonsterUnderTheBedFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/TheMonsterUnderTheBedFilterTest.kt @@ -1,11 +1,13 @@ package net.pterodactylus.rhynodge.filters.comics -import net.pterodactylus.rhynodge.filters.ResourceLoader.* -import net.pterodactylus.rhynodge.states.* -import net.pterodactylus.rhynodge.states.ComicState.* -import org.hamcrest.MatcherAssert.* -import org.hamcrest.Matchers.* -import org.junit.* +import net.pterodactylus.rhynodge.filters.ResourceLoader.loadDocument +import net.pterodactylus.rhynodge.states.ComicState +import net.pterodactylus.rhynodge.states.ComicState.Comic +import net.pterodactylus.rhynodge.states.ComicState.Strip +import net.pterodactylus.rhynodge.states.HtmlState +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.contains +import org.junit.jupiter.api.Test class TheMonsterUnderTheBedFilterTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesFilterTest.kt index 2d44796..08c0558 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesFilterTest.kt @@ -7,8 +7,8 @@ import net.pterodactylus.rhynodge.states.JsonState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.instanceOf -import org.junit.Assert.assertThrows -import org.junit.Test +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import java.time.Instant.parse class EpicGamesFilterTest { @@ -20,7 +20,7 @@ class EpicGamesFilterTest { @Test fun `filter throws exception when given html state`() { - assertThrows(IllegalArgumentException::class.java) { filter.filter(HttpState("", 200, "", byteArrayOf())) } + assertThrows { filter.filter(HttpState("", 200, "", byteArrayOf())) } } @Test diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesMergerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesMergerTest.kt index 49ade1f..6b22ec3 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesMergerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesMergerTest.kt @@ -7,8 +7,8 @@ import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.empty import org.hamcrest.Matchers.equalTo import org.hamcrest.Matchers.instanceOf -import org.junit.Assert.assertThrows -import org.junit.Test +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import java.time.Instant class EpicGamesMergerTest { @@ -20,12 +20,12 @@ class EpicGamesMergerTest { @Test fun `merger throws exception if previous state is not a free games state`() { - assertThrows(IllegalArgumentException::class.java) { merger.mergeStates(TestState(), emptyState) } + assertThrows { merger.mergeStates(TestState(), emptyState) } } @Test fun `merger throws exception if current state is not a free games state`() { - assertThrows(IllegalArgumentException::class.java) { merger.mergeStates(emptyState, TestState()) } + assertThrows { merger.mergeStates(emptyState, TestState()) } } @Test diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/FreeGamesStateTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/FreeGamesStateTest.kt index 15679c7..d89eaa1 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/FreeGamesStateTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/FreeGamesStateTest.kt @@ -5,7 +5,7 @@ import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains import org.hamcrest.Matchers.equalTo import org.jsoup.Jsoup -import org.junit.Test +import org.junit.jupiter.api.Test import java.time.Instant import java.time.ZoneOffset diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt index 008c69c..4d16e33 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractorTest.kt @@ -9,7 +9,7 @@ import org.hamcrest.Matchers.equalTo import org.hamcrest.Matchers.hasItems import org.hamcrest.TypeSafeDiagnosingMatcher import org.jsoup.Jsoup -import org.junit.Test +import org.junit.jupiter.api.Test import java.time.LocalDateTime /** diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt index bb2fa9b..6fb52cc 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt @@ -11,7 +11,7 @@ import org.hamcrest.Matchers.not import org.jsoup.Jsoup import org.jsoup.nodes.Element import org.jsoup.nodes.TextNode -import org.junit.Test +import org.junit.jupiter.api.Test import java.time.LocalDateTime class MovieStateTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt index cd2c7e0..b7ee7c8 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt @@ -5,20 +5,20 @@ import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.containsInAnyOrder import org.hamcrest.Matchers.empty import org.hamcrest.Matchers.equalTo -import org.junit.Assert.assertThrows -import org.junit.Test +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import java.time.LocalDateTime class SavoyMergerTest { @Test fun `merger throws exception if first state is not a movie state`() { - assertThrows(IllegalArgumentException::class.java) { merger.mergeStates(TestState(), MovieState(emptySet())) } + assertThrows { merger.mergeStates(TestState(), MovieState(emptySet())) } } @Test fun `merger throws exception if second state is not a movie state`() { - assertThrows(IllegalArgumentException::class.java) { merger.mergeStates(MovieState(emptySet()), TestState()) } + assertThrows { merger.mergeStates(MovieState(emptySet()), TestState()) } } @Test diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/mergers/ComicMergerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/mergers/ComicMergerTest.kt index 3f07181..e2afceb 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/mergers/ComicMergerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/mergers/ComicMergerTest.kt @@ -4,7 +4,7 @@ import net.pterodactylus.rhynodge.states.ComicState import net.pterodactylus.rhynodge.states.ComicState.Comic import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.contains -import org.junit.Test +import org.junit.jupiter.api.Test class ComicMergerTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/mergers/LastStateMergerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/mergers/LastStateMergerTest.kt index 07d2bee..1118484 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/mergers/LastStateMergerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/mergers/LastStateMergerTest.kt @@ -4,7 +4,7 @@ import net.pterodactylus.rhynodge.State import net.pterodactylus.rhynodge.states.StateManagerTest.TestState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo -import org.junit.Test +import org.junit.jupiter.api.Test class LastStateMergerTest { diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/queries/FallbackQueryTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/queries/FallbackQueryTest.kt index dd2a3c1..fe43511 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/queries/FallbackQueryTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/queries/FallbackQueryTest.kt @@ -4,14 +4,12 @@ import net.pterodactylus.rhynodge.Query import net.pterodactylus.rhynodge.State import net.pterodactylus.rhynodge.states.AbstractState import net.pterodactylus.rhynodge.states.FailedState -import net.pterodactylus.rhynodge.states.StateManagerTest import net.pterodactylus.rhynodge.states.StateManagerTest.TestState import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.`is` import org.hamcrest.Matchers.sameInstance -import org.junit.Rule -import org.junit.Test -import org.junit.rules.ExpectedException +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.mockito.Mockito.`when` import org.mockito.Mockito.mock import org.mockito.Mockito.never @@ -24,8 +22,6 @@ import org.mockito.Mockito.verify */ class FallbackQueryTest { - @JvmField @Rule val expectedException = ExpectedException.none()!! - private val firstQuery = mock(Query::class.java) private val secondQuery = mock(Query::class.java) private val thirdQuery = mock(Query::class.java) @@ -90,8 +86,7 @@ class FallbackQueryTest { @Test fun `fallback query can not be created without queries`() { - expectedException.expect(IllegalArgumentException::class.java) - FallbackQuery() + assertThrows { FallbackQuery() } } } diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/states/AbstractStateTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/states/AbstractStateTest.kt index 29d7386..d6362c3 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/states/AbstractStateTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/states/AbstractStateTest.kt @@ -2,7 +2,7 @@ package net.pterodactylus.rhynodge.states import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo -import org.junit.Test +import org.junit.jupiter.api.Test import java.time.Clock import java.time.Instant.now import java.time.ZoneOffset.UTC diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/states/JsonStateTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/states/JsonStateTest.kt index b21095e..326c196 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/states/JsonStateTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/states/JsonStateTest.kt @@ -3,7 +3,7 @@ package net.pterodactylus.rhynodge.states import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.spotify.hamcrest.jackson.JsonMatchers.jsonObject import org.hamcrest.MatcherAssert.assertThat -import org.junit.Test +import org.junit.jupiter.api.Test import java.io.StringWriter class JsonStateTest { diff --git a/src/test/kotlin/net/pterodactylus/util/exception/ExceptionsTest.kt b/src/test/kotlin/net/pterodactylus/util/exception/ExceptionsTest.kt index 151da89..65108a6 100644 --- a/src/test/kotlin/net/pterodactylus/util/exception/ExceptionsTest.kt +++ b/src/test/kotlin/net/pterodactylus/util/exception/ExceptionsTest.kt @@ -2,7 +2,7 @@ package net.pterodactylus.util.exception import org.hamcrest.MatcherAssert import org.hamcrest.Matchers -import org.junit.Test +import org.junit.jupiter.api.Test import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicReference -- 2.7.4