shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplay.java
public void setRotation(int rotation) {
    if (isJB()) {
      this.rotation = rotation;
    } else {
      ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
          di -> di.rotation = rotation);
    }
  }
public void setRotation(int rotation) {
    if (isJB()) {
      this.rotation = rotation;
    } else {
      ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
          di -> di.rotation = rotation);
    }
  }
Changes the rotation for this display.

Any registered {@link android.hardware.display.DisplayManager.DisplayListener}s will be
notified of the change.

@param rotation one of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
{@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}