code: private static <T> T populateObject(T object) {
      Class clazz = object.getClass();
  
      while (clazz != null) {
        String name = clazz.getName();
        if (name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("android.")) {
          // Skip system classes
          break;
        }
  
        Field[] fields = clazz.getDeclaredFields();
  
        for (Field field : fields) {
          if (!Modifier.isFinal(field.getModifiers())) {
            Object value = generateValue(field);
            field.setAccessible(true);
            try {
              field.set(object, value);
            } catch (Exception e) {
              throw new RuntimeException("Failed to populate object of type "
                  + object.getClass().getCanonicalName(), e);
            }
          }
        }
        clazz = clazz.getSuperclass();
      }
  
      return object;
    }
docs: All non-final fields in object are populated with mock values.
  
  @param object Object to populate
  @param <T>    Type of object
  @return Populated object