public static Mode parse(String value) {
    if (StringUtils.isBlank(value)) {
      throw new IllegalArgumentException(ExceptionMessage.INVALID_MODE.getMessage(value));
    }

    try {
      return parseNumeric(value);
    } catch (NumberFormatException e) {
      // Treat as symbolic
      return parseSymbolic(value);
    }
  }
@Test
  public void numerics() {
    Mode parsed = ModeParser.parse("777");
    assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
    assertEquals(Mode.Bits.ALL, parsed.getGroupBits());
    assertEquals(Mode.Bits.ALL, parsed.getOtherBits());

    parsed = ModeParser.parse("755");
    assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
    assertEquals(Mode.Bits.READ_EXECUTE, parsed.getGroupBits());
    assertEquals(Mode.Bits.READ_EXECUTE, parsed.getOtherBits());

    parsed = ModeParser.parse("644");
    assertEquals(Mode.Bits.READ_WRITE, parsed.getOwnerBits());
    assertEquals(Mode.Bits.READ, parsed.getGroupBits());
    assertEquals(Mode.Bits.READ, parsed.getOtherBits());
  }