ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Subverting Java Access Protection for Unit Testing
Subject:   Public Introductions for Private Methods
Date:   2003-11-13 13:05:51
From:   anonymous2
Another option is to apply privileged public introductions that provide pass-through delegation to non-public methods and fields. A simple combination of a doclet and an aspect compiler can provide this level of access for all of your non-public members at once. The doclet generates the aspect source files for application by the aspect compiler prior to the unit test compile.


Write the unit tests against the introductions if you need to test non-public code. I prefer this simple unit test compile-time option to mucking about with the security manager.


1 to 2 of 2
  1. Public Introductions for Private Methods
    2010-01-04 23:52:18  sw1527 [View]

  2. Public Introductions for Private Methods
    2003-11-21 16:06:55  anonymous2 [View]

    • Public Introductions for Private Methods
      2005-10-05 08:53:29  pizza22005 [View]

1 to 2 of 2