2007/9/19, Robert Krahn &lt;<a href="mailto:rksm@gmx.net">rksm@gmx.net</a>&gt;:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">
<div style="margin: 0px;"><span class="q"><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
Hello Denis,</font></div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
I dipped into your&nbsp;BehaviorMockup package and it seems really powerful. I like the block notation so that the expected behavior is stated after the exercised code. This way the tests can be more uniform (Four-Phase Test) and clearer.
</font></div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
One thing I didn&#39;t found out is how to have the mocks ignore certain message calls.</font></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
E.g. I want this to pass:</font></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
[:mock | mock m1; m2] should&nbsp;lenient&nbsp;satisfy: [:mock | mock m1]</font></div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
I tried it the &#39;lenient way&#39; as above but I get a SpecFailed: WrongMessageSelector. How can one do this?</font></div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
Best regards,</font></div><div style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
Robert</font></div><div style="margin: 0px; min-height: 14px;"><br></div></span><div style="margin: 0px; min-height: 14px;">p.s.</div><div style="margin: 0px; min-height: 14px;">I wrote this mail to the squeak-dev mailing list first but forgot to add your mail address in the header so I am writing you an extra mail.
</div></div></div></blockquote><div><br>Hi Robert.<br>
<br><span class="q"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
Expression<br><br></font></span><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><span class="q"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
[:mock | mock m1; m2] should&nbsp;lenient&nbsp;satisfy: [:mock | mock m1]</font></span><br></blockquote><span class="q"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
<br>
creates and verifies LenientBehaviorSpec. It only defines arbitrary message sends order.<br><br>If you want mock ignores any message sends you must write something like:<br><br></font></span><div style="margin-left: 40px;">
<span class="q"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
[:mock | mock m1; m2] should&nbsp;lenient&nbsp;satisfy: [:mock | mock anyMessage. mock m1]</font></span><br></div><span class="q"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" face="Helvetica" size="3">
<br>But it is not implemented yet. I think it takes a few hours work..<br><br></font></span></div></div>Possible implementation: <br><ul><li>Create subclass MessageSemanticsSpec named like AnyMessageSemanticsSpec</li><li>
Implement #validate: method like in MessageSemanticsSpec but without some testings for message selector and arguments</li><li>Change method BehaviorSpecBuilder&gt;&gt;evaluateBehavior:</li></ul><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">

    <blockquote><blockquote>
      </blockquote></blockquote></blockquote><div style="margin-left: 80px;">aMessageSend selector = #anyMessage ifTrue: [</div><blockquote style="margin-left: 40px;">
    </blockquote>
  

  <blockquote style="margin-left: 40px;">
    </blockquote><div style="margin-left: 120px;">messageSendSpec := MessageSendSpec new.<br>
messageSendSpec add: (AnyMessageSemanticsSpec from: aMessageSend).<br>
spec add: messageSendSpec.<br>
&nbsp;^MessageSendSpecBuilder on: messageSendSpec]<br>

    </div><div style="margin-left: 80px;">&nbsp;<br>
messageSendSpec := MessageSendSpec withMessageSemanticsLike: aMessageSend.<br>spec add: messageSendSpec.<br>&nbsp;^MessageSendSpecBuilder on: messageSendSpec<br><br></div>With that stuff you can write specification for ignoring any message any times:
<br><br><div style="margin-left: 40px;">mock anyMessage useArbitrary<br></div><br>And use null object (with eating message sends):<br><br><div style="margin-left: 40px;">mock anyMessage <br><div style="margin-left: 40px;">
<div style="margin-left: 40px;">useArbitrary<br></div><div style="margin-left: 40px;">willReturn: Null new<br></div><br></div></div>Of course you can implement some nice helper messages for it.<br><br>Sorry for my english.
<br><br>Best regards, <br>Denis<br>

<br><div style="margin-left: 80px;">
    </div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><blockquote><blockquote>
    
  </blockquote>
</blockquote>
</blockquote>