Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 80462 invoked from network); 17 Apr 2006 11:02:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Apr 2006 11:02:45 -0000 Received: (qmail 56375 invoked by uid 500); 17 Apr 2006 11:02:35 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 56324 invoked by uid 500); 17 Apr 2006 11:02:34 -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 56313 invoked by uid 99); 17 Apr 2006 11:02:34 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Apr 2006 04:02:34 -0700 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mloenko@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nproxy.gmail.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Apr 2006 04:02:33 -0700 Received: by nproxy.gmail.com with SMTP id i2so345298nfe for ; Mon, 17 Apr 2006 04:02:12 -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:content-transfer-encoding:content-disposition:references; b=lvz1lat2z8Dfd0cbKkY0YVB/DzBOIvHfY7NGTDVthq0N96kC1pj32sOk075nz9BQdicS8TahS7lkYCfJam5I2eaykDZlrXsuqRkorTUtLys5zoTQRvxabCcjYnUekBYxkOL/Yak5s68PZRWuFFJ4Yq6MvDER3fyrCq8kxsplq7Q= Received: by 10.48.31.4 with SMTP id e4mr471523nfe; Mon, 17 Apr 2006 04:02:12 -0700 (PDT) Received: by 10.49.6.5 with HTTP; Mon, 17 Apr 2006 04:02:12 -0700 (PDT) Message-ID: <906dd82e0604170402k22036760v427ae8f3ca8861ee@mail.gmail.com> Date: Mon, 17 Apr 2006 18:02:12 +0700 From: "Mikhail Loenko" To: harmony-dev@incubator.apache.org Subject: Re: should strings in exceptions match the reference implementation? In-Reply-To: <4d0b24970604170136t76d5d2ces5f5b511f094c508d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <46d21a9a0604162306q73e0a474hca0d4a15bc8d66ed@mail.gmail.com> <906dd82e0604162314w718bbc39ie266dc63da24c6a0@mail.gmail.com> <46d21a9a0604162325r57f4e420t1eb9e56fafde46d8@mail.gmail.com> <4d0b24970604162336w8580472y49507407c268966f@mail.gmail.com> <46d21a9a0604162346g1bbba723u4a5f2f0aa25bb2f6@mail.gmail.com> <4d0b24970604170019n6a85f398n16032db0a5492be7@mail.gmail.com> <906dd82e0604170109v6d02445r7f9e7c6d557a54ec@mail.gmail.com> <4d0b24970604170136t76d5d2ces5f5b511f094c508d@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Andrew, 2006/4/17, Andrew Zhang : > Hi, MIkhail, > > Thanks for the information. > > I took a quick look > at tests/api/java/util/regex/PatternSyntaxExceptionTest. > Yes, the exception description is important to developers, however, I can= 't > find the message defination in java spec. > Am I missing something? Being compatible to the spec is required but not sufficient for the success= . For example we follow common sense, not only the spec. > If no, don't you think test case such as > "assertTrue(e.getDescription().equals("')' > is expected."));" is a bit arbitrary? > Is there anything wrong if the message is sth. like "Expected ")" is not > found" ? Both are meaningful to developers. Both messages are correct. Example of incorrect message for given password = are "Missing ;" or "Incorrect password" or etc We have to have tests that catch improper change in the source code. For example, if the message "Expected )" is designed then we have to verify that exactly that message is thrown. And if someone tries to make a change in the logic so that "Incorrect password" is thrown then our unit test will catch it. I know that test will not pass on RI but that is expected - it tests specif= ics of Harmony implementation and should not pass on RI Thanks, Mikhail > > As Anton Avtamonov metioned(most of us agreeed) ,we should not regard suc= h > difference as a failure. > Then, How to solve such problems? IMHO, we'd better avoid such cases, or = at > most, checking some key information instead of using "equals", e.g, in th= is > case, > checking whether the message is not null and contains ")" or sth like. > > I don't think change to code as following would solve the problem: > if(Util.IsHarmony()){ > assertTrue(e.getDescription().equals("')' is expected.")); > } > Then who's the rule maker? PatternSyntaxException class developers? > Maybe if there are some spec or documents which define these messages, I'= ll > support such testing way. :-) > > On 4/17/06, Mikhail Loenko wrote: > > > > > > > > Hi Andrew > > > > Look at tests/api/java/util/regex/PatternSyntaxExceptionTest to get som= e > > ideas. When you parse something and that something is incorrect the > > message does matter. > > > > And you have a test to verify that you do not report ()s mismatch when > > the problem is somewhere else. > > > > Thanks, > > Mikhail > > > > > I think RI should contain similiar information so that we can write s= ome > > > test cases, which both RI and Harmony could pass, by verifying keywor= ds > > > instead. > > > If "isHarmony()" is used, then what's the expected message? I don't > > think > > > there's a "Harmony exception message spec" :-) > > > People may argue which message is best or more meanfuling :) > > > > > > Wishes, > > > > -- > > > > Anton Avtamonov, > > > > Intel Middleware Products Division > > > > > > > > -------------------------------------------------------------------= -- > > > > Terms of use : http://incubator.apache.org/harmony/mailing.html > > > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.or= g > > > > For additional commands, e-mail: harmony-dev-help@incubator.apache.= org > > > > > > > > > > > > > > > > > -- > > > Andrew Zhang > > > China Software Development Lab, IBM > > > > > > > > > > --------------------------------------------------------------------- > > 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 > > > > > > > -- > Andrew Zhang > China Software Development Lab, IBM > > --------------------------------------------------------------------- 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