### Question:
CmdQuery extends ComposableCommand { public String getSqlPattern() { return sqlPattern; } CmdQuery(byte[] packet, String dalGroup); byte[] getSendBuf(); void rewriteBytes(byte[] bytes); boolean isSharded(); boolean hasMappingShardingSql(); String getTypeName(); boolean isGrayRead(); void setGrayRead(boolean grayRead); ShardingRouter getShardingRouter(); void setShardingRouter(ShardingRouter shardingRouter); String getSqlId(); String getSqlPattern(); void setWhiteFieldsFilter(Predicate<String> whiteFieldsFilter); void setIndexHints(String indexHints); String getIndexHints(); static final String PING_SQL; static final String SYNC_SQL; static final String EMPTY_SQL; public byte type; public String schema; public String query; public String queryComment; public String queryWithoutComment; public QUERY_TYPE curQueryType; public QUERY_TYPE queryType; public boolean isBindMasterExpr; public boolean needCacheResult; public String table; public String specifyDB; public String originalTable; public Map<String, String> metaMap; public String rid; public String rpcid; public String appid; public String shardKey; public String shardValue; public String shardKeyAndValue; public long affectedRows; public Send2BatchCond batchCond; public ShardingSQL shardingSql; }### Answer:
@Test public void testParseFailShortSQLPattern() throws Exception { String invalidSQL = "slect * from eleme_order"; Com_Query comQuery = new Com_Query(); comQuery.setQuery(invalidSQL); CmdQuery query = new CmdQuery(comQuery.toPacket(), "eosgroup"); query.execute(); assertEquals("[dal_parse_fail] slect * from eleme_order", query.getSqlPattern()); }
@Test public void testParseFailLongSQLPattern() throws Exception { String invalidSQL = "slect * from eleme_order where 'longlonglonglong' = 'longlonglong'"; Com_Query comQuery = new Com_Query(); comQuery.setQuery(invalidSQL); CmdQuery query = new CmdQuery(comQuery.toPacket(), "eosgroup"); query.execute(); assertEquals("[dal_parse_fail] slect * from eleme_order where '", query.getSqlPattern()); }