@Test
 public void TestDeleteFilterRuleById() {
   FilterRule fr1 = new FilterRule("first", "The first rule");
   fr1.addPattern("123");
   fr1.addPattern("4*56");
   long ruleid = FilterRuleProvider.InsertRow(myDb, fr1);
   FilterRuleProvider.DeleteFilterRule(myDb, ruleid);
   FilterRule fr2 = FilterRuleProvider.FindFilterRule(myDb, ruleid);
   assertNull("Rule deleted and not found", fr2);
 }
 @Test
 public void TestAllFilterRuleNames() {
   FilterRule fr1 = new FilterRule("first", "The first rule");
   fr1.addPattern("123");
   fr1.addPattern("4*56");
   FilterRule fr2 = new FilterRule("second", "The second rule");
   FilterRuleProvider.InsertRow(myDb, fr1);
   FilterRuleProvider.InsertRow(myDb, fr2);
   ArrayList<String> names = FilterRuleProvider.AllRuleNames(myDb);
   assertEquals("Two names expected", 2, names.size());
   assertTrue("Contains first", names.contains("first"));
   assertTrue("Contains second", names.contains("second"));
 }
 @Test
 public void InsertAndTestFilterRules() {
   FilterRule fr1 = new FilterRule("first", "The first rule");
   fr1.addPattern("123");
   fr1.addPattern("4*56");
   FilterRule fr2 = new FilterRule("second", "The second rule");
   FilterRuleProvider.InsertRow(myDb, fr1);
   FilterRuleProvider.InsertRow(myDb, fr2);
   ArrayList<FilterRule> rules = FilterRuleProvider.AllFilterRules(myDb);
   assertEquals("There should be two records", 2, rules.size());
   assertEquals("The deserialized first rule equals the original", fr1, rules.get(0));
   assertEquals("The deserialized second rule equals the original", fr2, rules.get(1));
 }
 @Test
 public void TestFindAndUpdateFilterRule() {
   FilterRule fr1 = new FilterRule("first", "The first rule");
   fr1.addPattern("123");
   fr1.addPattern("4*56");
   long ruleid = FilterRuleProvider.InsertRow(myDb, fr1);
   FilterRule fr2 = FilterRuleProvider.FindFilterRule(myDb, ruleid);
   assertEquals("The two rules are equals", fr1, fr2);
   FilterRule fr3 = new FilterRule("first", "The first rule updated");
   fr3.addPattern("123");
   FilterRuleProvider.UpdateFilterRule(myDb, ruleid, fr3);
   FilterRule fr4 = FilterRuleProvider.FindFilterRule(myDb, ruleid);
   assertEquals("The two rules are equals after update", fr3, fr4);
 }