SmtpCommand { public static SmtpCommand valueOf(CharSequence commandName) { ObjectUtil.checkNotNull(commandName, "commandName"); SmtpCommand command = COMMANDS.get(commandName.toString()); return command != null ? command : new SmtpCommand(AsciiString.of(commandName)); } private  SmtpCommand(AsciiString name); static SmtpCommand valueOf(CharSequence commandName); AsciiString name(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final SmtpCommand EHLO; static final SmtpCommand HELO; static final SmtpCommand MAIL; static final SmtpCommand RCPT; static final SmtpCommand DATA; static final SmtpCommand NOOP; static final SmtpCommand RSET; static final SmtpCommand EXPN; static final SmtpCommand VRFY; static final SmtpCommand HELP; static final SmtpCommand QUIT; }
@Test public void getCommandFromCache() { assertSame(SmtpCommand.DATA, SmtpCommand.valueOf("DATA")); assertSame(SmtpCommand.EHLO, SmtpCommand.valueOf("EHLO")); assertNotSame(SmtpCommand.EHLO, SmtpCommand.valueOf("ehlo")); }
@Test public void equalsIgnoreCase() { assertEquals(SmtpCommand.MAIL, SmtpCommand.valueOf("mail")); assertEquals(SmtpCommand.valueOf("test"), SmtpCommand.valueOf("TEST")); }