Skip to content

Commit

Permalink
Remove Guava dependency from JVM tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Sep 20, 2023
1 parent b3feccc commit 63ad349
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
5 changes: 0 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
)

lazy val coreJVM = core.jvm
.settings(
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "32.1.2-jre" % "test"
)
)

lazy val coreJS = core.js.settings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
Expand Down
16 changes: 6 additions & 10 deletions core/jvm/src/test/scala/scodec/bits/ByteVectorJvmTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.scalacheck.Prop.forAll
import Arbitrary.arbitrary
import Arbitraries._

import java.util.{Base64 => JBase64}
import java.util.concurrent.Callable

class ByteVectorJvmTest extends BitsSuite {
Expand All @@ -53,36 +54,31 @@ class ByteVectorJvmTest extends BitsSuite {

property("toBase64") {
forAll { (b: ByteVector) =>
val guavaB64 = com.google.common.io.BaseEncoding.base64
assert(ByteVector.view(guavaB64.decode(b.toBase64)) == b)
assert(ByteVector.view(JBase64.getDecoder.decode(b.toBase64)) == b)
}
}

property("toBase64NoPad") {
forAll { (b: ByteVector) =>
val guavaB64 = com.google.common.io.BaseEncoding.base64.omitPadding()
assert(ByteVector.view(guavaB64.decode(b.toBase64NoPad)) == b)
assert(ByteVector.view(JBase64.getDecoder.decode(b.toBase64NoPad)) == b)
}
}

property("toBase64Url") {
forAll { (b: ByteVector) =>
val guavaB64 = com.google.common.io.BaseEncoding.base64Url()
assert(ByteVector.view(guavaB64.decode(b.toBase64Url)) == b)
assert(ByteVector.view(JBase64.getUrlDecoder.decode(b.toBase64Url)) == b)
}
}

property("toBase64UrlNoPad") {
forAll { (b: ByteVector) =>
val guavaB64 = com.google.common.io.BaseEncoding.base64Url().omitPadding()
assert(ByteVector.view(guavaB64.decode(b.toBase64UrlNoPad)) == b)
assert(ByteVector.view(JBase64.getUrlDecoder.decode(b.toBase64UrlNoPad)) == b)
}
}

property("fromBase64") {
forAll { (b: ByteVector) =>
val guavaB64 = com.google.common.io.BaseEncoding.base64
assert(ByteVector.fromValidBase64(guavaB64.encode(b.toArray)) == b)
assert(ByteVector.fromValidBase64(JBase64.getEncoder.encodeToString(b.toArray)) == b)
}
}

Expand Down

0 comments on commit 63ad349

Please sign in to comment.