Reputation: 4906
Why does the following code fails:
session.getGameId should be 10
with this error
';' expected but integer literal found.
However this one doesn't fail
session.getGameId should be(10)
Does it have to do with the way that the apply
method is called
Upvotes: 2
Views: 115
Reputation: 53348
session.getGameId should be 10
means
(session.getGameId).should(be).(10)
whereas
session.getGameId should be(10)
means
(session.getGameId).should(be(10))
Obviously, the first one can't compile since it is not valid to call an integer literal in this position. See this question for further explanation when you can leave out parentheses and dots in Scala.
Upvotes: 2