Skip to content

Instantly share code, notes, and snippets.

@lazyval
Created November 26, 2019 13:22
Show Gist options
  • Save lazyval/346f5f45484119aaf6d3bddb6e33d1d0 to your computer and use it in GitHub Desktop.
Save lazyval/346f5f45484119aaf6d3bddb6e33d1d0 to your computer and use it in GitHub Desktop.
Scalacheck example for trivial scalatest violation
package com.spotify
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import org.scalatest.{FlatSpec, Matchers}
class ExampleTest extends FlatSpec with Matchers with GeneratorDrivenPropertyChecks {
implicit override val generatorDrivenConfig =
PropertyCheckConfig(minSize = 100, maxSize = 200)
"strings" should "have same length when lowercased / uppercased" in {
forAll { x: String =>
val uppercased = x.toUpperCase()
val lowercased = x.toLowerCase()
uppercased.length should equal(lowercased.length)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment