233 reputation
410
bio website dp4j.com
location Bolzano, Italy
age
visits member for 3 years, 4 months
seen Dec 24 '11 at 23:43

Author of dp4j.jar, which lets you test access private methods in Java without writing any reflection API code. The necessary reflection code is injected by dp4j at compile-time. So you only write:

@Test
public void aTest(){
  PrivateConstructor pc = new PrivateConstructor("Hello!");

Instead of:

import java.lang.reflect.*;

@Test
public void aTest() throws IllegalAccessException, NoSuchMethodException
, InvocationTargetException, InstantiationException {
    Constructor pcInit = PrivateConstructor.class.getDeclaredConstructor(String.class);
    pcInit.setAccessible(true);
    PrivateConstructor pc = (PrivateConstructor) pcInit.newInstance("Hello!");

Check it out at www.dp4j.com


233 Reputation

5 Jul 15
5 Jun 21 '13
5 Apr 26 '13
5 Jan 3 '13
5 Dec 9 '12
5 Feb 6 '12
12 Dec 24 '11
5 Nov 8 '11
10 Aug 27 '11
24 Aug 26 '11
10 May 14 '11
5 May 13 '11
7 May 10 '11
2 Apr 12 '11
5 Apr 11 '11
5 Apr 10 '11
2 Mar 21 '11
5 Mar 20 '11
10 Mar 19 '11
100 Mar 4 '11