title: ScalaTest - writing custom matchers
body: <p>I am running into a problem while writing a custom matcher for NodeSeq:</p>
  
  <pre><code>private def matchXML(expected: NodeSeq) = new Matcher[NodeSeq] {
    def apply(left: NodeSeq): MatchResult = MatchResult(left xml_== expected,
      "XML structure was not the same (watch spaces in tag texts)",
      "XML messages were equal")
  }
  </code></pre>
  
  <p>This compiles, but the following piece of code:</p>
  
  <pre><code>val expected : NodeSeq = ...
  val xml : NodeSeq = ... 
  xml should matchXML(expected)
  </code></pre>
  
  <p>causes:</p>
  
  <pre><code>error: overloaded method value should with alternatives:
  (beWord: XMLStripDecoratorTests.this.BeWord)XMLStripDecoratorTests.this.ResultOfBeWordForAnyRef[scala.collection.GenSeq[scala.xml.Node]] &lt;and&gt;
  (notWord: XMLStripDecoratorTests.this.NotWord)XMLStripDecoratorTests.this.ResultOfNotWordForAnyRef[scala.collection.GenSeq[scala.xml.Node]] &lt;and&gt;
  (haveWord: XMLStripDecoratorTests.this.HaveWord)XMLStripDecoratorTests.this.ResultOfHaveWordForSeq[scala.xml.Node] &lt;and&gt;
  (rightMatcher: org.scalatest.matchers.Matcher[scala.collection.GenSeq[scala.xml.Node]])Unit
  cannot be applied to (org.scalatest.matchers.Matcher[scala.xml.NodeSeq])
  xml should (matchXML(expected))
  </code></pre>
  
  <p>Any ideas what this means?</p>