Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-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 0B5C2DC2B for ; Fri, 30 Nov 2012 07:43:10 +0000 (UTC) Received: (qmail 44332 invoked by uid 500); 30 Nov 2012 07:43:09 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 44204 invoked by uid 500); 30 Nov 2012 07:43:08 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 44175 invoked by uid 99); 30 Nov 2012 07:43:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 07:43:07 +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 ted.dunning@gmail.com designates 209.85.215.171 as permitted sender) Received: from [209.85.215.171] (HELO mail-ea0-f171.google.com) (209.85.215.171) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 07:43:02 +0000 Received: by mail-ea0-f171.google.com with SMTP id n10so90368eaa.30 for ; Thu, 29 Nov 2012 23:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=e4Uu8C8Hx0JuPAF/+OF0q75tqxhAHk6B0TgXx+zrhNc=; b=zqPOpYWTyMMV4URuwMfgNaD04WkLOxDIYEutHtmXH++5RWzHE/54nY0xCYcFNXPI2c 1Iq8KUZMKxG1/Y9+j7k4ZGLHGwk5QhlVeqkFQlkgVVQ1iEJc81OVjEIHWYeSD4K/AMqC 6CcoP9p81TUFluYpE0HwpkBMsABN/1vNsk2Y9LBV7aTtV5bpdwgj0ou1aImZX7ftGsxE 8hzjbIuJaYh3gtW4T9PoUWa/oH/vJrJHYr96xVWxO4HOg5iHk3zGfxM7D4XLbjhV1Osv uEbGAK0j0ecxBTQ9xWBeQ5o4hQasqun1V9JZMO61Ovpbl+YNiKB3yQD3VSQOu8XjYgi6 UJrg== Received: by 10.14.214.132 with SMTP id c4mr1671331eep.18.1354261361295; Thu, 29 Nov 2012 23:42:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.74.89 with HTTP; Thu, 29 Nov 2012 23:42:10 -0800 (PST) In-Reply-To: References: <20121126223622.GL3397@dusk.harfang.homelinux.org> <20121127112736.GN3397@dusk.harfang.homelinux.org> <20121127144200.GR3397@dusk.harfang.homelinux.org> <50B4DAB2.2060003@gmail.com> <20121127160822.GT3397@dusk.harfang.homelinux.org> <20121127224320.GV3397@dusk.harfang.homelinux.org> From: Ted Dunning Date: Thu, 29 Nov 2012 23:42:10 -0800 Message-ID: Subject: Re: [math] Checking preconditions on package private functions To: Commons Developers List Content-Type: multipart/alternative; boundary=047d7b621df85f814c04cfb18be8 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b621df85f814c04cfb18be8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable That's fine. I think raw use of reflection might make the tests pretty complicated, but the idea is reasonable. Jmockit allows mocking of static methods (I have used it to mock System.nanoTime(), for instance). By using a partial mock class, you can gain access to private methods as well. On Thu, Nov 29, 2012 at 10:59 PM, S=C3=A9bastien Brisard < sebastien.brisard@m4x.org> wrote: > Does anyone oppose the usage of reflection in unit testing to access > private methods? > I personnally think it is a good compromise between encapsulation and > comprehensive testing. > --047d7b621df85f814c04cfb18be8--