From d0bdcfccab87f87f10d4d89468e7aa7d02f26b89 Mon Sep 17 00:00:00 2001 From: Kevin Lee Date: Fri, 1 Nov 2024 21:56:23 +1100 Subject: [PATCH] Add missing tests for Uri.toURL --- .../scala/refined4s/types/networkCompatSpec.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/refined4s-core/jvm/src/test/scala/refined4s/types/networkCompatSpec.scala b/modules/refined4s-core/jvm/src/test/scala/refined4s/types/networkCompatSpec.scala index 190869a..0cf6c9a 100644 --- a/modules/refined4s-core/jvm/src/test/scala/refined4s/types/networkCompatSpec.scala +++ b/modules/refined4s-core/jvm/src/test/scala/refined4s/types/networkCompatSpec.scala @@ -15,6 +15,7 @@ trait networkCompatSpec { def compatTests: List[Test] = List( property("test Uri.toUrl", testUriToUrl), + property("test Uri.toURL", testUriToURL), // example("test Url(valid URL String)", testUrlApply), example("test Url(URL)", testUrlApplyURL), @@ -44,6 +45,17 @@ trait networkCompatSpec { actual ==== expected } + def testUriToURL: Property = + for { + uri <- networkGens.genUrlString.log("uri") + } yield { + @SuppressWarnings(Array("org.wartremover.warts.JavaNetURLConstructors")) + val expected = new URL(uri) + val actual = Uri.unsafeFrom(uri).toURL + + actual ==== expected + } + // def testUrlApply: Result = {