Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved exception matchers to have stacktrace in case of failure #250

Closed
wants to merge 1 commit into from
Closed

Conversation

edmondop
Copy link

@edmondop edmondop commented Apr 4, 2014

As from ML discussion, the case is simple:

class FailingSpec extends Specification{

    def is = s2""""
                                    This is cool $e1      """

    def e1 =
        foreach( 1 to 10 ){
            index =>foreach (index to index * 3) {
                subIndex => subIndex must explodeBooh or throwA[NullPointerException]
            }
    }

    def explodeBooh = new Matcher[Int]{
        override def apply[S <: Int](t: Expectable[S]): MatchResult[S] = {
            val value = t.value
            if(value%2==0)
                explodingMethod
            else
                result(true,"It works","It doesn't work",t)
        }
    }

    def explodingMethod[S]:MatchResult[S] = {
        subExplodingMethod

    }

    def subExplodingMethod[S]:MatchResult[S] = {
        throw new IllegalArgumentException("baah")
    }
}

@etorreborre
Copy link
Owner

Thanks for this pull request. I incorporated as f6fe94f (and republished 2.4-SNAPSHOT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants