@Test public void shouldMakePrivateFieldAccessibleProperty() throws Exception { final String[] value = new String[1]; Private pojo = new Private(); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { Object object = invocation.getArguments()[1]; Field field = (Field) invocation.getArguments()[2]; value[0] = (String) field.get(object); return null; } }).when(visitor).visit("priv", pojo, Private.class.getDeclaredField("priv")); scanner.scan(pojo); verify(visitor).visit("priv", pojo, Private.class.getDeclaredField("priv")); assertEquals("value", value[0]); }
public void scan(Object object) { try { scan(object, "", false, new ArrayList<Object>()); } catch (JMSException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
JmsPropertyScanner { public void scan(Object object) { try { scan(object, "", false, new ArrayList<Object>()); } catch (JMSException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }
JmsPropertyScanner { public void scan(Object object) { try { scan(object, "", false, new ArrayList<Object>()); } catch (JMSException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } JmsPropertyScanner(Visitor visitor); }
JmsPropertyScanner { public void scan(Object object) { try { scan(object, "", false, new ArrayList<Object>()); } catch (JMSException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } JmsPropertyScanner(Visitor visitor); void scan(Object object); }
JmsPropertyScanner { public void scan(Object object) { try { scan(object, "", false, new ArrayList<Object>()); } catch (JMSException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } JmsPropertyScanner(Visitor visitor); void scan(Object object);  }