public static void setStaticField(Field field, Object fieldNewValue) {
    try {
      if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL) {
        throw new IllegalArgumentException("Cannot set the value of final field " + field);
      }
      field.setAccessible(true);
      field.set(null, fieldNewValue);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
@Test
  public void setFinalStaticFieldReflectively_withFieldName_setsStaticFields() {
    RuntimeException thrown =
        assertThrows(
            RuntimeException.class,
            () -> ReflectionHelpers.setStaticField(ExampleWithFinalStatic.class, "FIELD", 101));
    assertThat(thrown)
        .hasCauseThat()
        .hasMessageThat()
        .contains("Cannot set the value of final field");
  }