Scala specs 2 matcher which looks like this (for example):
def Size (Size: IT): Matter [Product element] = {Product element: Product element = & gt; Val sizeOfproductElement = productElement.size sizeOffproduct element alias "Size of product element"} ^ beEqualTo (size) and execution in code:
UpdatedProductElement SEOOf (1) throws error:
java.lang.Exception: 'org.specs2.matcher.ThrownExpectations$$onon$1@6a3b7968'
'1'
What should I do differently?
Edit: If is deleted, the exam has passed:
Def size has come (size: int): matures [product element] = {product element: product element = & gt; ProductElement.size} ^ beEqualTo (size)
beEqualTo () < Compare a value (such as size ) with the any value, with the code / a org.specs2.matcher.ThrownExpectation , which you The correct way to create with matcher aka is the sizeOf
def size off (size: int) : Matter [Producer] = {Product Element: Product Element = & gt; Each Matcher [T] is a > Apply The method that accepts the values hope [t] (basically a kind of expected value is T plus an optional statement that you create with Aka ).
: IT): Matter [product element] = {product element: product element = & gt; (ProductElement.size == Size, "Product element $ $ {productElement.size} is not size $ size")}
No comments:
Post a Comment