<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">By the way, using a mocking library or not would not fundamentally change how I test either:<div><span class="Apple-tab-span" style="white-space:pre"> </span>the persistent layer</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>clients of the persistent layer</div><div><br></div><div>So follow-up to last email. Not only "what are you wanting to test, the later itself or clients of the layer". Additionally,</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>what problem(s) are you trying to solve that requires needing to know "how to test persistent layer effectively" - this is a solution to a perceived problem and not a problem itself, so what problem are you trying to solve.</div><div><br></div><div>If you are meaning to test the persistent layer, does your underlying persistent store's schema make heave use of stored procedures, or are you primarily using an ORM tool (if so, top-down, bottom-up or meet in the middle mapping).</div><div><br></div><div>If you instead planning on testing clients that use the persistent layer, how does client code get access to an object representing access to that layer (a dao). Does it</div><div>- use new directly</div><div>- get it passed in (in a ctor, method, setter)</div><div>- use some kind of IoC container, e.g. Spring</div></blockquote><div><br></div>I don't think there's enough time to get more than a superficial hand waving at your question. However, it turns out that the solution to this problem is general. Introduce a level of indirection!-)<div><br></div><div>Brett<br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div> </div></blockquote><div><div><div>On Apr 11, 2011, at 8:36 PM 4/11/11, Rupesh Bhochhibhoya wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<pre style="word-wrap:break-word; font-size:10.0pt; font-family:Tahoma; color:black">I have always used nice mocks. And didn't really know why other mocks didn't work well for me. So, thanks for info.
Also it would be nice if you could share how to test persistent layer effectively using Jmockit.
"Brett L. Schuchert" <<a href="mailto:schuchert@yahoo.com">schuchert@yahoo.com</a>> wrote:
</pre>
<div>Might as well start the talk now...
<div><br>
</div>
<div>When using mock libraries, by default use "nice" or "not strict" mocks. Most of them default to strict mocks. The problem with this is that doing so makes the tests more fragile and dependent on incidental complexity rather than essential responsibility.</div>
<div><br>
</div>
<div>So in the case of easy mocks, don't use "createMock" by default, instead prefer "createNiceMock". Only use createMock when you really want to verify all messages sent. This is actually a fringe case when doing<i><b> focused</b></i> unit tests. This is
typically counter-intuitive. It only becomes clear as individuals move from tests with lots of checks to focused, single-check or single-logical-check based tests.</div>
<div><br>
</div>
<div>OK, discuss...</div>
<div><br>
</div>
<div>Brett</div>
<div>
<div>
<div>
<div>On Apr 11, 2011, at 11:05 AM 4/11/11, Rupesh Bhochhibhoya wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div lang="EN-US" link="blue" vlink="purple" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div class="WordSection1" style="page: WordSection1; ">
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">I appreciate if you can demonstrate examples with TDD/BDD. And also if you could show its advantages over EasyMock, that will be helpful too.<o:p></o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); ">Rupesh<o:p></o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125); "><o:p> </o:p></span></div>
<div>
<div style="border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-top-style: solid; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding-top: 3pt; padding-right: 0in; padding-bottom: 0in; padding-left: 0in; ">
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; ">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; "><span class="Apple-converted-space"> </span><a href="mailto:jug-bounces@lists.okcjug.org" style="color: blue; text-decoration: underline; ">jug-bounces@lists.okcjug.org</a><span class="Apple-converted-space"> </span>[mailto:jug-bounces@lists.okcjug.org]<span class="Apple-converted-space"> </span><b>On
Behalf Of<span class="Apple-converted-space"> </span></b>Brett L. Schuchert<br>
<b>Sent:</b><span class="Apple-converted-space"> </span>Monday, April 11, 2011 10:52 AM<br>
<b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:jug@lists.okcjug.org" style="color: blue; text-decoration: underline; ">jug@lists.okcjug.org</a><br>
<b>Subject:</b><span class="Apple-converted-space"> </span>Re: [OKC JUG] Reminder - meeting Tuesday, April 12th<o:p></o:p></span></div>
</div>
</div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
Oh yeah, I suppose I should prep (mostly kidding).<o:p></o:p></div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
I already have a "story" for this presentation but I'm open to adjusting if anybody has anything in particular they'd like to me to cover. Just reply to this chain with request.<o:p></o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
One thing I will be demonstrating is overriding static methods with the tool - which is cool, too cool, but cool.<o:p></o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
Brett<o:p></o:p></div>
<div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
On Apr 11, 2011, at 10:35 AM 4/11/11, Brian Sheldon wrote:<o:p></o:p></div>
</div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<br>
<br>
<o:p></o:p></div>
<div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
We have a meeting tomorrow. We will be providing food and drinks this month thanks to MBO sponsoring again this year.<o:p></o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
Please go register<span class="Apple-converted-space"> </span><a href="http://okcjug.org/registration" target="_blank" style="color: blue; text-decoration: underline; ">http://okcjug.org/registration</a> so we know how much food to get and who to pick from
for the door prize.<o:p></o:p></div>
</div>
<div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
</div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; text-indent: -0.25in; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Symbol; color: rgb(85, 85, 85); "><span>·<span style="font: normal normal normal 7pt/normal 'Times New Roman'; "> <span class="Apple-converted-space"> </span></span></span></span><span style="font-size: 9pt; font-family: Verdana, sans-serif; color: rgb(85, 85, 85); ">Sponsor: <a href="http://www.mbopartners.com/" target="_blank" style="color: blue; text-decoration: underline; "><span style="color: rgb(41, 112, 166); text-decoration: none; ">MBO
Partners</span></a><o:p></o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; text-indent: -0.25in; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Symbol; color: rgb(85, 85, 85); "><span>·<span style="font: normal normal normal 7pt/normal 'Times New Roman'; "> <span class="Apple-converted-space"> </span></span></span></span><span style="font-size: 9pt; font-family: Verdana, sans-serif; color: rgb(85, 85, 85); ">Speaker: <a href="http://okcjug.org/bios/brett-schuchert" target="_blank" style="color: blue; text-decoration: underline; "><span style="color: rgb(41, 112, 166); text-decoration: none; ">Brett
Schuchert</span></a><o:p></o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; text-indent: -0.25in; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Symbol; color: rgb(85, 85, 85); "><span>·<span style="font: normal normal normal 7pt/normal 'Times New Roman'; "> <span class="Apple-converted-space"> </span></span></span></span><span style="font-size: 9pt; font-family: Verdana, sans-serif; color: rgb(85, 85, 85); "><a href="http://code.google.com/p/jmockit/" target="_blank" style="color: blue; text-decoration: underline; "><span style="color: rgb(41, 112, 166); text-decoration: none; ">JMockit</span></a> -
Things you shouldn’t do when testing…<o:p></o:p></span></div>
<h3 style="margin-right: 0in; margin-left: 0in; font-size: 13.5pt; font-family: 'Times New Roman', serif; margin-top: 0in; margin-bottom: 0.0001pt; ">
<span style="font-family: Arial, sans-serif; color: rgb(85, 85, 85); letter-spacing: -0.6pt; ">Agenda<o:p></o:p></span></h3>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; text-indent: -0.25in; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Symbol; color: rgb(85, 85, 85); "><span>·<span style="font: normal normal normal 7pt/normal 'Times New Roman'; "> <span class="Apple-converted-space"> </span></span></span></span><span style="font-size: 9pt; font-family: Verdana, sans-serif; color: rgb(85, 85, 85); ">11:30
am – Welcome Announcements<o:p></o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; text-indent: -0.25in; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Symbol; color: rgb(85, 85, 85); "><span>·<span style="font: normal normal normal 7pt/normal 'Times New Roman'; "> <span class="Apple-converted-space"> </span></span></span></span><span style="font-size: 9pt; font-family: Verdana, sans-serif; color: rgb(85, 85, 85); ">11:40
am – Lightning Talks begin<o:p></o:p></span></div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; text-indent: -0.25in; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Symbol; color: rgb(85, 85, 85); "><span>·<span style="font: normal normal normal 7pt/normal 'Times New Roman'; "> <span class="Apple-converted-space"> </span></span></span></span><span style="font-size: 9pt; font-family: Verdana, sans-serif; color: rgb(85, 85, 85); ">12:40
pm – Wrap Up<o:p></o:p></span></div>
<h3 style="margin-right: 0in; margin-left: 0in; font-size: 13.5pt; font-family: 'Times New Roman', serif; margin-top: 0in; margin-bottom: 0.0001pt; ">
<span style="font-family: Arial, sans-serif; color: rgb(85, 85, 85); letter-spacing: -0.6pt; ">Presentation Information<o:p></o:p></span></h3>
<h3 style="margin-right: 0in; margin-left: 0in; font-size: 13.5pt; font-family: 'Times New Roman', serif; margin-top: 0in; margin-bottom: 0.0001pt; line-height: 12.75pt; ">
<span style="font-size: 10pt; font-family: Arial, sans-serif; color: rgb(85, 85, 85); letter-spacing: -0.6pt; font-weight: normal; ">JMockIt is a powerful and easy (perhaps too easy) to use mocking tool that allows you to do things that defy logic. Examples
include stubbing static methods, changing final classes and pretty much anything that byte code injection on the fly (per test) allows. We’ll look at some of those things along with more traditional test double creation and then discuss why on the one hand
it is nice to have this power, on the other hand you should almost never use it.</span><span style="font-family: Arial, sans-serif; color: rgb(85, 85, 85); letter-spacing: -0.6pt; "><o:p></o:p></span></h3>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<br>
<span style="color: rgb(136, 136, 136); ">--<span class="Apple-converted-space"> </span><br>
Brian</span><o:p></o:p></div>
</div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
_______________________________________________<br>
Jug mailing list<br>
<a href="mailto:Jug@lists.okcjug.org" style="color: blue; text-decoration: underline; ">Jug@lists.okcjug.org</a><br>
<a href="http://lists.okcjug.org/listinfo.cgi/jug-okcjug.org" style="color: blue; text-decoration: underline; ">http://lists.okcjug.org/listinfo.cgi/jug-okcjug.org</a><o:p></o:p></div>
</div>
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 12pt; font-family: 'Times New Roman', serif; ">
<o:p> </o:p></div>
</div>
</div>
_______________________________________________<br>
Jug mailing list<br>
<a href="mailto:Jug@lists.okcjug.org" style="color: blue; text-decoration: underline; ">Jug@lists.okcjug.org</a><br>
<a href="http://lists.okcjug.org/listinfo.cgi/jug-okcjug.org" style="color: blue; text-decoration: underline; ">http://lists.okcjug.org/listinfo.cgi/jug-okcjug.org</a><br>
</div>
</span></blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
_______________________________________________<br>Jug mailing list<br><a href="mailto:Jug@lists.okcjug.org">Jug@lists.okcjug.org</a><br>http://lists.okcjug.org/listinfo.cgi/jug-okcjug.org<br></blockquote></div><br></div></div></body></html>