Created
March 14, 2011 21:41
-
-
Save p3t0r/869944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BigFailRepository extends Repository[String] { | |
override def withConnection(f: (Connection => Option[String])): Option[String] = { | |
throw new UnsupportedOperationException("BAM") | |
} | |
} | |
class SmallFailRepository extends Repository[String] { | |
var numFails = 0 | |
override def withConnection(f: (Connection => Option[String])): Option[String] = { | |
if (numFails < 2) { | |
numFails = numFails + 1 | |
throw new UnsupportedOperationException("BAM") | |
} | |
f(null) // left out transaction mngnt to keep stuff simple | |
} | |
} | |
class NoFailRepository extends Repository[String] { | |
override def withConnection(f: (Connection => Option[String])): Option[String] = { | |
f(null) // left out transaction mngnt to keep stuff simple | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment