### Question:
SQLJudgeEngine { public SQLStatement judge() { Lexer lexer = new Lexer(sql, new Dictionary()); lexer.nextToken(); while (true) { TokenType tokenType = lexer.getCurrentToken().getType(); if (tokenType instanceof Keyword) { if (DefaultKeyword.SELECT == tokenType) { return new SelectStatement(); } else if (DefaultKeyword.INSERT == tokenType || DefaultKeyword.UPDATE == tokenType || DefaultKeyword.DELETE == tokenType) { return new DMLStatement(); } } if (tokenType instanceof Assist && Assist.END == tokenType) { throw new SQLParsingException("Unsupported SQL statement: [%s]", sql); } lexer.nextToken(); } }  SQLStatement judge();  }### Answer:
@Test public void assertPrepareParseForSelect() { assertThat(new SQLJudgeEngine(" \t \n \r \fsElecT\t\n * from table ").judge(), instanceOf(DQLStatement.class)); }
@Test public void assertPrepareParseForInsert() { assertThat(new SQLJudgeEngine(" - - COMMENT \t \n \r \fInsert\t\n into table ").judge(), instanceOf(DMLStatement.class)); }
@Test public void assertPrepareParseForUpdate() { assertThat(new SQLJudgeEngine(" \t \n \r \fuPdAte\t\n table ").judge(), instanceOf(DMLStatement.class)); }
@Test public void assertPrepareParseForDelete() { assertThat(new SQLJudgeEngine(" \t \n \r \fdelete\t\n table ").judge(), instanceOf(DMLStatement.class)); }
@Test(expected = SQLParsingException.class) public void assertPrepareParseForInvalidSQL() { new SQLJudgeEngine("int i = 0").judge(); }