Path: csiph.com!news.bbs.geek.nz!.POSTED.agency.bbs.geek.nz!not-for-mail From: Eric Sosman (Eric Sosman) Newsgroups: comp.lang.java.programmer Subject: Re: Calling deprecated methods Date: Wed, 13 Dec 2017 08:21:10 +1200 Organization: fsxNet Usenet Gateway | bbs.geek.nz/#fsxNet Message-ID: <2472835388@f38.n261.z1.binkp.net> References: <1795335397@f38.n261.z1.binkp.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: news.bbs.geek.nz; posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E"; logging-data="1013"; mail-complaints-to="abuse@news.bbs.geek.nz" User-Agent: VSoup v1.2.9.47Beta [95/NT] X-MailConverter: SoupGate-Win32 v1.05 X-Comment-To: Eric Douglas Xref: csiph.com comp.lang.java.programmer:37848 On 12/13/2017 7:51 AM, Eric Douglas wrote: > On Tuesday, December 12, 2017 at 5:57:21 PM UTC-5, Eric Sosman wrote: >> ... or mostly right. A setter that is supposed to enforce a >> restriction like "the value must be strictly positive" should be >> tested to ensure that it does in fact throw the proper exception. >> Similarly for setters with state dependencies like "the value can >> be changed at will before the doItNowBabe() method is called, but >> cannot be changed thereafter." >> >>> [... good advice about test harnesses ...] >>> Been there, done that, got the benefits. >> >> Ditto, seconded, and Aayy-men! > > Interaction is sometimes the hard part of testing. Method A works fine, unless you've called Method B with value C then Method D with value E first? Lots of things are the hard part of testing. :( Some practitioners who have given the matter much more thought than I ever will are scrupulous about distinguishing between "unit tests" and "integration tests" and "system tests" (Aside: when did "acceptance tests" go out of fashion?), but to me the demarcation lines seem not perfectly sharp. A test for your A/B/D example might be viewed as an integration test of the A/B/D methods, or as a unit test of the component that owns all three (does it make the advertised state transitions in the expected way?). Deeper thinkers than I may have a useful way to classify such things; for myself, I just try to figure out Some Kind Of Test and let the nomenclature slide. -- esosman@comcast-dot-net.invalid Eleven hundred thirty-four days to go.