231 reputation
411
bio website dp4j.com
location Bolzano, Italy
age
visits member for 3 years, 8 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


Sep
24
awarded  Autobiographer
Jul
2
awarded  Curious
Apr
5
awarded  Popular Question
Jun
18
awarded  Notable Question
Jun
5
awarded  Notable Question
May
28
awarded  Notable Question
Oct
24
awarded  Popular Question
Aug
24
awarded  Popular Question
Apr
19
awarded  Popular Question
Mar
4
awarded  Yearling
Dec
24
comment How to create a sudo user that cannot delete me?
that's a shame. I expected the OS to have such capability.
Dec
24
accepted How to create a sudo user that cannot delete me?
Dec
24
asked How to create a sudo user that cannot delete me?
Aug
26
accepted How do I delete all lines with “.png” in a file?
Aug
26
comment How do I delete all lines with “.png” in a file?
no inline option? I'd like to get rid of ".png" and ".jpg" for that matter. Also case-insenstive?
Aug
26
asked How do I delete all lines with “.png” in a file?
Aug
26
accepted How to use $? and test to check function?
Aug
26
asked How to use $? and test to check function?
Jun
3
comment How to copy all html files from a directory tree to a single directory?
setopt globstar doesn't work on bash 4.2 both on mac and linux.
Jun
2
comment How to copy all html files from a directory tree to a single directory?
-J is not in gnu xargs (4.4.2)