@Test public void use_the_correct_setter_on_the_target() throws Exception { // given SomeBean someBean = new SomeBean(); Field theField = someBean.getClass().getDeclaredField("theField"); File valueToInject = new File("path"); // when boolean injected = new BeanPropertySetter(someBean, theField, true).set(valueToInject); // then assertTrue(injected); assertTrue(someBean.theFieldSetterWasUsed); assertSame(valueToInject, someBean.getTheField()); }