Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E57C09E39 for ; Wed, 22 Feb 2012 20:34:11 +0000 (UTC) Received: (qmail 45441 invoked by uid 500); 22 Feb 2012 20:34:10 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 45360 invoked by uid 500); 22 Feb 2012 20:34:10 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 45106 invoked by uid 99); 22 Feb 2012 20:34:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 20:34:10 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yuzhihong@gmail.com designates 74.125.82.51 as permitted sender) Received: from [74.125.82.51] (HELO mail-ww0-f51.google.com) (74.125.82.51) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 20:34:05 +0000 Received: by wgbdy1 with SMTP id dy1so320244wgb.20 for ; Wed, 22 Feb 2012 12:33:44 -0800 (PST) Received-SPF: pass (google.com: domain of yuzhihong@gmail.com designates 10.180.86.134 as permitted sender) client-ip=10.180.86.134; Authentication-Results: mr.google.com; spf=pass (google.com: domain of yuzhihong@gmail.com designates 10.180.86.134 as permitted sender) smtp.mail=yuzhihong@gmail.com; dkim=pass header.i=yuzhihong@gmail.com Received: from mr.google.com ([10.180.86.134]) by 10.180.86.134 with SMTP id p6mr38460392wiz.0.1329942824091 (num_hops = 1); Wed, 22 Feb 2012 12:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=jsWpnUcsanK1eIA6tAvQ/izZSkDogwGRMKAktrFO1jg=; b=DYn1uK/m4uuejuOYuhWRmaxepJIunRjrsXVo8LUWpm20kPqHWGXgR4pbxqh7jC/DU6 7qCKU8gJinWUZJohPgqQQ4wlHgvYIzU3ZMl9EbqxbFWoUED+M7izrn0udD8dS3LDBd2n V3/3HXUSnl7Op6LiduHK14yKIAWqTYjpxG/Gs= MIME-Version: 1.0 Received: by 10.180.86.134 with SMTP id p6mr31818365wiz.0.1329942824018; Wed, 22 Feb 2012 12:33:44 -0800 (PST) Received: by 10.216.122.138 with HTTP; Wed, 22 Feb 2012 12:33:43 -0800 (PST) In-Reply-To: References: Date: Wed, 22 Feb 2012 12:33:43 -0800 Message-ID: Subject: Re: Mocking classes for unit tests Was: asynchbase-1.2.0-rc1 is available for download From: Ted Yu To: dev@hbase.apache.org Content-Type: multipart/alternative; boundary=f46d044286c498e19c04b993710e --f46d044286c498e19c04b993710e Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I logged https://issues.apache.org/jira/browse/HBASE-5456 I think we should make "for test only" methods private in the above JIRA. Feel free to comment on the JIRA or in this thread. Thanks On Wed, Feb 22, 2012 at 12:24 PM, tsuna wrote: > On Wed, Feb 22, 2012 at 9:23 AM, Ted Yu wrote: > > Benoit's comment is directly related to our practice, especially when w= e > > add new methods which are only called by unit tests. > > I didn't dare to say it, but now that you do=85 :P > > HBase exposes a TON of implementation details in public APIs. Makes > things harder to refactor because you don't know if anyone out there > is relying on this method or extending that class. > > Mocking out things that are hidden is certainly a bit harder than > calling into a public API javadoced as "for test only", but if it > keeps the APIs clean, then I think it's worthwhile. > > -- > Benoit "tsuna" Sigoure > Software Engineer @ www.StumbleUpon.com > --f46d044286c498e19c04b993710e--