@Test void setFlagShouldRejectRecentFlag() { assertThatThrownBy(() -> DecoderUtils.setFlag("\\Recent", new Flags())) .isInstanceOf(DecodingException.class); }
public static void setFlag(String flagString, Flags flags) throws DecodingException { if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED_ALL_CAPS)) { flags.add(Flags.Flag.ANSWERED); } else if (flagString.equalsIgnoreCase(MessageFlags.DELETED_ALL_CAPS)) { flags.add(Flags.Flag.DELETED); } else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT_ALL_CAPS)) { flags.add(Flags.Flag.DRAFT); } else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED_ALL_CAPS)) { flags.add(Flags.Flag.FLAGGED); } else if (flagString.equalsIgnoreCase(MessageFlags.SEEN_ALL_CAPS)) { flags.add(Flags.Flag.SEEN); } else { if (flagString.equalsIgnoreCase(MessageFlags.RECENT_ALL_CAPS)) { throw new DecodingException(HumanReadableText.INVALID_SYSTEM_FLAG, "\\Recent flag is now allowed to set."); } else { flags.add(flagString); } } }
DecoderUtils { public static void setFlag(String flagString, Flags flags) throws DecodingException { if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED_ALL_CAPS)) { flags.add(Flags.Flag.ANSWERED); } else if (flagString.equalsIgnoreCase(MessageFlags.DELETED_ALL_CAPS)) { flags.add(Flags.Flag.DELETED); } else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT_ALL_CAPS)) { flags.add(Flags.Flag.DRAFT); } else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED_ALL_CAPS)) { flags.add(Flags.Flag.FLAGGED); } else if (flagString.equalsIgnoreCase(MessageFlags.SEEN_ALL_CAPS)) { flags.add(Flags.Flag.SEEN); } else { if (flagString.equalsIgnoreCase(MessageFlags.RECENT_ALL_CAPS)) { throw new DecodingException(HumanReadableText.INVALID_SYSTEM_FLAG, "\\Recent flag is now allowed to set."); } else { flags.add(flagString); } } } }
DecoderUtils { public static void setFlag(String flagString, Flags flags) throws DecodingException { if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED_ALL_CAPS)) { flags.add(Flags.Flag.ANSWERED); } else if (flagString.equalsIgnoreCase(MessageFlags.DELETED_ALL_CAPS)) { flags.add(Flags.Flag.DELETED); } else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT_ALL_CAPS)) { flags.add(Flags.Flag.DRAFT); } else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED_ALL_CAPS)) { flags.add(Flags.Flag.FLAGGED); } else if (flagString.equalsIgnoreCase(MessageFlags.SEEN_ALL_CAPS)) { flags.add(Flags.Flag.SEEN); } else { if (flagString.equalsIgnoreCase(MessageFlags.RECENT_ALL_CAPS)) { throw new DecodingException(HumanReadableText.INVALID_SYSTEM_FLAG, "\\Recent flag is now allowed to set."); } else { flags.add(flagString); } } }  }
DecoderUtils { public static void setFlag(String flagString, Flags flags) throws DecodingException { if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED_ALL_CAPS)) { flags.add(Flags.Flag.ANSWERED); } else if (flagString.equalsIgnoreCase(MessageFlags.DELETED_ALL_CAPS)) { flags.add(Flags.Flag.DELETED); } else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT_ALL_CAPS)) { flags.add(Flags.Flag.DRAFT); } else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED_ALL_CAPS)) { flags.add(Flags.Flag.FLAGGED); } else if (flagString.equalsIgnoreCase(MessageFlags.SEEN_ALL_CAPS)) { flags.add(Flags.Flag.SEEN); } else { if (flagString.equalsIgnoreCase(MessageFlags.RECENT_ALL_CAPS)) { throw new DecodingException(HumanReadableText.INVALID_SYSTEM_FLAG, "\\Recent flag is now allowed to set."); } else { flags.add(flagString); } } }  static void setFlag(String flagString, Flags flags); static LocalDateTime decodeDateTime(CharSequence chars); static int decodeNumber(char high, char low); static int decodeZone(char zoneDeterminent, char zoneDigitOne, char zoneDigitTwo, char zoneDigitThree, char zoneDigitFour); static boolean isSimpleDigit(char character); static int decodeYear(char milleniumChar, char centuryChar, char decadeChar, char yearChar); static int decodeMonth(char monthFirstChar, char monthSecondChar, char monthThirdChar); static int decodeFixedDay(char dayHigh, char dayLow); static int decodeDigit(char character); }
DecoderUtils { public static void setFlag(String flagString, Flags flags) throws DecodingException { if (flagString.equalsIgnoreCase(MessageFlags.ANSWERED_ALL_CAPS)) { flags.add(Flags.Flag.ANSWERED); } else if (flagString.equalsIgnoreCase(MessageFlags.DELETED_ALL_CAPS)) { flags.add(Flags.Flag.DELETED); } else if (flagString.equalsIgnoreCase(MessageFlags.DRAFT_ALL_CAPS)) { flags.add(Flags.Flag.DRAFT); } else if (flagString.equalsIgnoreCase(MessageFlags.FLAGGED_ALL_CAPS)) { flags.add(Flags.Flag.FLAGGED); } else if (flagString.equalsIgnoreCase(MessageFlags.SEEN_ALL_CAPS)) { flags.add(Flags.Flag.SEEN); } else { if (flagString.equalsIgnoreCase(MessageFlags.RECENT_ALL_CAPS)) { throw new DecodingException(HumanReadableText.INVALID_SYSTEM_FLAG, "\\Recent flag is now allowed to set."); } else { flags.add(flagString); } } }  static void setFlag(String flagString, Flags flags); static LocalDateTime decodeDateTime(CharSequence chars); static int decodeNumber(char high, char low); static int decodeZone(char zoneDeterminent, char zoneDigitOne, char zoneDigitTwo, char zoneDigitThree, char zoneDigitFour); static boolean isSimpleDigit(char character); static int decodeYear(char milleniumChar, char centuryChar, char decadeChar, char yearChar); static int decodeMonth(char monthFirstChar, char monthSecondChar, char monthThirdChar); static int decodeFixedDay(char dayHigh, char dayLow); static int decodeDigit(char character);  }