@Test
  public void settingInaccessibleFieldBypassingProtection() throws Exception {
    WithInaccessibleField target = new WithInaccessibleField();

    setField(target.getClass().getDeclaredField("i"), target, 3, true);

    assertEquals(3, target.i);
  }
  @Test
  public void settingInaccessibleFieldWithoutBypassingProtection() throws Exception {
    WithInaccessibleField target = new WithInaccessibleField();

    thrown.expect(ReflectionException.class);
    thrown.expectMessage(IllegalAccessException.class.getName());

    setField(target.getClass().getDeclaredField("i"), target, 4, false);
  }