Skip to content

Commit

Permalink
Merge pull request #240 from twitter/ianoc/fixUrlTest
Browse files Browse the repository at this point in the history
Fix flaky URL test
  • Loading branch information
johnynek committed Feb 2, 2016
2 parents a6f8dde + 611e6e2 commit 5cae9de
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ class StringBijectionLaws extends CheckProperties with BaseProperties {

def toUrl(s: String): Try[URL] = Try(new URL("http://" + s + ".com"))

// Gen's identifier will produce string starting with a lower case alpha
// followed by an alpha numeric sequence of characters
implicit val urlArb: Arbitrary[URL] =
Arbitrary { Arbitrary.arbitrary[String] map (toUrl(_)) suchThat (_.isSuccess) map (_.get) }
Arbitrary { identifier map (toUrl(_)) suchThat (_.isSuccess) map (_.get) }

// This is trivially a bijection if it injective
property("URL -> String") {
Expand Down

0 comments on commit 5cae9de

Please sign in to comment.