Example #1
0
  public void testUpdate() {
    dbs.open();

    dbs.insert(null);
    ContentValues values = new ContentValues();
    values.put(PinYin.PinYinColumns.CHINESE, "坏");
    values.put(PinYin.PinYinColumns.PINYIN, "huai");
    values.put(PinYin.PinYinColumns.ENGLISH, "Bad");
    dbs.update(null, PinYin.PinYinColumns.CHINESE + " = ?", new String[] {"好"});
  }
Example #2
0
  public void testInsert() {
    dbs.open();

    dbs.insert(null);
    Cursor c =
        dbs.query(
            new String[] {PinYin.PinYinColumns.CHINESE, PinYin.PinYinColumns.PINYIN},
            null,
            null,
            null);
    assertEquals(c.getCount(), 1);

    c.moveToFirst();
    String chinese = c.getString(c.getColumnIndex(PinYin.PinYinColumns.CHINESE));
    assertEquals(chinese, "好");
  }
Example #3
0
 public void testGetAll() {
   dbs.open();
   List<PinYin> py = dbs.getAll(1);
   for (PinYin p : py) System.out.println(p);
 }
Example #4
0
 public void testGet() {
   dbs.open();
   PinYin py = dbs.get("坏");
   System.out.println(py);
 }
Example #5
0
  public void testDelete() {
    dbs.open();

    dbs.insert(null);
    dbs.delete(PinYin.PinYinColumns.CHINESE + " = ?", new String[] {"好"});
  }
Example #6
0
 @Override
 protected void tearDown() throws Exception {
   dbs.close();
 }