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


Mar
19
comment How can I find and replace with a new line?
this replaced it with space and not new lines. Output: a b c
Mar
19
asked How can I find and replace with a new line?
Mar
6
comment Why $JAVA_HOME does not persist on a mac?
my shell is Terminal.app. But why cannot it just work from the Property Editor List like other variables?
Mar
6
asked Why $JAVA_HOME does not persist on a mac?
Mar
6
revised Why curl -O -C on mac fails to download
edited tags
Mar
4
awarded  Scholar
Mar
4
accepted Why curl -O -C on mac fails to download
Mar
4
answered Why curl -O -C on mac fails to download
Mar
1
comment Why curl -O -C on mac fails to download
It doesn't fail. $ curl --fail -O repo2.maven.org/maven2/com/dp4j/dp4j/1.1/… % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 341k 100 341k 0 0 576k 0 --:--:-- --:--:-- --:--:-- 739k
Mar
1
comment Why curl -O -C on mac fails to download
i did all that..it's full of byte code (I already had the problem you guys refer to =) )
Mar
1
comment Why curl -O -C on mac fails to download
tried that..It's not the issue (it works on linux). The jar is indeed downloaded, but corrupt.
Mar
1
asked Why curl -O -C on mac fails to download