code: private static void ensureValidOrientations(Alignment horizontalAlignment, Alignment verticalAlignment) {
          if (!horizontalAlignment.isHorizontal()) {
              throw new IllegalArgumentException("The horizontal alignment must be one of: left, center, right, fill, default.");
          }
          if (!verticalAlignment.isVertical()) {
              throw new IllegalArgumentException("The vertical alignment must be one of: top, center, bottom, fill, default.");
          }
      }
docs: Checks and verifies that the horizontal alignment is a horizontal and the vertical alignment
  is vertical.
  
  @param horizontalAlignment the horizontal alignment
  @param verticalAlignment the vertical alignment
  @throws IllegalArgumentException if an alignment is invalid