Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 5112 invoked from network); 15 Sep 2006 13:25:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Sep 2006 13:25:07 -0000 Received: (qmail 79500 invoked by uid 500); 15 Sep 2006 13:25:07 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 78805 invoked by uid 500); 15 Sep 2006 13:25:05 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 78794 invoked by uid 99); 15 Sep 2006 13:25:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2006 06:25:05 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of zhanghuangzhu@gmail.com designates 66.249.82.226 as permitted sender) Received: from [66.249.82.226] (HELO wx-out-0506.google.com) (66.249.82.226) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2006 06:24:56 -0700 Received: by wx-out-0506.google.com with SMTP id s13so3117192wxc for ; Fri, 15 Sep 2006 06:24:30 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=m4eYRul8Y6fPoHq9LwKPd9L4U8/ITOfW7Hc47s5NI17GwbnJ9wRTL4nPLTZVzgC/XpHUfQBCqXBhyAWHuKvh201KdHFw7pcahkliW25uv7E4SzmBtMEn0YJHj6p31UIXaFE/SnF1UQtQ3BaFUNYudzu+Q/0Uqfps4YaVouPhGII= Received: by 10.70.31.18 with SMTP id e18mr14642914wxe; Fri, 15 Sep 2006 06:24:30 -0700 (PDT) Received: by 10.70.123.4 with HTTP; Fri, 15 Sep 2006 06:24:29 -0700 (PDT) Message-ID: <4d0b24970609150624n35bdffddh71a50c43e0df7889@mail.gmail.com> Date: Fri, 15 Sep 2006 21:24:29 +0800 From: "Andrew Zhang" To: harmony-dev@incubator.apache.org, geir@pobox.com Subject: Re: [testing][beans] reverse engineering of RI In-Reply-To: <450AA526.6080804@pobox.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_343985_24915468.1158326669827" References: <2c9597b90609150556r359ddebv192ced44be6248a1@mail.gmail.com> <450AA526.6080804@pobox.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_343985_24915468.1158326669827 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 9/15/06, Geir Magnusson Jr. wrote: > > > > Alexei Zakharov wrote: > > Hi all, > > > > While investigating one of the failed tests from the beans module > > (PersistenceDelegateTest#*) I have discovered that the test is doing a > > reverse engineering in fact. It passes some worm-like object to public > > API method and then analyzes the calling stacktrace of each of its > > methods by means of > > > > StackTraceElement[] eles =3D (new Throwable()).getStackTrace(); > > if (eles[i].getClassName().equals(=85) && > > eles[i].getMethodName().equals(..)) {=85} > > > > In that way, to enable this test we need to rewrite our code and make > > it identical to RI's (at least in respect to the stack trace). Such > > testing technique may be applied to many parts of Java API, not only > > beans. Of course I can imagine some user application doing this but > > such people should probably know what they do. > > > > Personally I don't like such methods of testing and vote for > > refactoring of these tests. Other opinions? Thoughts? > > That's insane. Does the Spec require a specific call sequence? Maybe it wants to assert some methods are invoked. But the code is unacceptable! Sometimes, spec does point out or hint invoke one method would lead to invoke another one. But instead of these reverse engineering codes, using mock subclass and invoke flag could be a solution. geir > > > > > Thanks, > > > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > --=20 Andrew Zhang China Software Development Lab, IBM ------=_Part_343985_24915468.1158326669827--