A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.
129
reputation
1
1
5

simpatico

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

0
answers
2
questions
~28k
people reached
  • Bolzano, Italy
  • Member for 8 years, 8 months
  • 10 profile views
  • Last seen Jul 17 '12 at 12:50

Top tags (5)

Score 0
Posts 2
Score 0
Posts 1
Score 0
Posts 1
Score 0
Posts 1
Score 0
Posts 1

Top posts (2) All Questions Answers | Votes Newest

Badges (7)

Gold

1

Rarest

Silver

1

Rarest

Bronze

5

Rarest