Permalink
Browse files

Added Failure.apply(String, Throwable)

  • Loading branch information...
johanflint committed Feb 15, 2012
1 parent d63b614 commit 2c0fe4204309dd4157367daa20153e97fbf85c3a
@@ -91,6 +91,7 @@ sealed abstract class BoiteVide extends Box[Nothing] {
object Failure {
def apply(message: String) = new Failure(message, Empty)
def apply(throwable: Throwable) = new Failure(throwable.getMessage, Full(throwable))
+ def apply(message: String, throwable: Throwable) = new Failure(message, Full(throwable))
}
sealed case class Failure(message: String, exception: Box[Throwable]) extends BoiteVide {
@@ -62,4 +62,8 @@ class FailureTest extends FlatSpec with ShouldMatchers with MockitoSugar {
"To list" should "return an empty list" in {
Empty.toList should equal (List())
}
+
+ "Failure.apply(message, throwable)" should "be equal to calling new" in {
+ Failure(Message, Throwable) should equal (failure)
+ }
}

0 comments on commit 2c0fe42

Please sign in to comment.