public void testSqlActionShardingRulePatternMatchingNormally() {
Tweet t = new Tweet();
t.setId(15000L);
t.setTweet("anything");
IBatisRoutingFact fact = new IBatisRoutingFact(
"com.alibaba.cobar.client.entity.Tweet.create", t);
assertTrue(rule.isDefinedAt(fact));
List<String> shards = rule.action();
assertTrue(CollectionUtils.isNotEmpty(shards));
assertEquals(2, shards.size());
for (String shard : shards) {
assertTrue(ArrayUtils.contains(DEFAULT_SHARDS, shard));
}
fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.update", t);
assertFalse(rule.isDefinedAt(fact));
t.setId(20000L);
fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.create", t);
assertFalse(rule.isDefinedAt(fact));
fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.create", null);
assertFalse(rule.isDefinedAt(fact));
fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.create", new Object());
assertFalse(rule.isDefinedAt(fact));
}