1/* 2 * Copyright 2001-2008 Artima, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package org.scalatest.matchers 17 18import org.scalatest._ 19 20class MatchResultSpec extends FreeSpec with ShouldMatchers { 21 22 "The MatchResult companion object factory method" - { 23 "that takes two strings works correctly" in { 24 val mr = MatchResult(true, "one", "two") 25 mr should have ( 26 'matches (true), 27 'failureMessage ("one"), 28 'negatedFailureMessage ("two"), 29 'midSentenceFailureMessage ("one"), 30 'midSentenceNegatedFailureMessage ("two") 31 ) 32 val ms = MatchResult(false, "aaa", "bbb") 33 ms should have ( 34 'matches (false), 35 'failureMessage ("aaa"), 36 'negatedFailureMessage ("bbb"), 37 'midSentenceFailureMessage ("aaa"), 38 'midSentenceNegatedFailureMessage ("bbb") 39 ) 40 } 41 "that takes four strings works correctly" in { 42 val mr = MatchResult(true, "one", "two", "three", "four") 43 mr should have ( 44 'matches (true), 45 'failureMessage ("one"), 46 'negatedFailureMessage ("two"), 47 'midSentenceFailureMessage ("three"), 48 'midSentenceNegatedFailureMessage ("four") 49 ) 50 val ms = MatchResult(false, "aaa", "bbb", "ccc", "ddd") 51 ms should have ( 52 'matches (false), 53 'failureMessage ("aaa"), 54 'negatedFailureMessage ("bbb"), 55 'midSentenceFailureMessage ("ccc"), 56 'midSentenceNegatedFailureMessage ("ddd") 57 ) 58 } 59 } 60} 61 62