101 reputation
2
bio website dp4j.com
location Bolzano, Italy
age
visits member for 3 years, 11 months
seen May 12 '13 at 20:00

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


This user has not answered any questions
This user has not asked any questions
This user has not participated in any tags
Stack Overflow 3,041 rep 73988
Unix & Linux 241 rep 1412
English Language & Usage 147 rep 4
Ask Different 119 rep 27
Graphic Design 116 rep 115

1 Vote Cast

all time   by type  
1 up 1 question
0 down 0 answer