116 reputation
15
bio website dp4j.com
location Bolzano, Italy
age
visits member for 3 years, 5 months
seen Jul 17 '12 at 12:50

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


Sep
24
awarded  Autobiographer
Jul
1
awarded  Student
Apr
23
awarded  Notable Question
Nov
8
awarded  Popular Question
May
13
asked How to add drop caps in photoshop?
May
5
asked How to get a full background from a photo?
Jan
28
awarded  Excavator
Jan
28
awarded  Editor
Jan
28
revised Making a business card. Any advice?
typo