package eoe.demo;import java.util.List;import it.bean.Person;import it.service.PersonService;import android.test.AndroidTestCase;import android.util.Log;/**** 执行PersonService的测试**/public class PersonServiceTest extends AndroidTestCase {private static final String tag="PersonServiceTest";public void testsave()throws Exception{PersonService personservice=new PersonService(this.getContext());for(int i=0;i<10;i++){personservice.save(new Person("huhuanhuan",(short)33));}}public void testfindbyid(){PersonService personservice=new PersonService(this.getContext());Person p=personservice.findbyid(1);Log.i(tag,p.toString());}public void testupdate(){Person person=new Person(1,"chun",(short)20);PersonService personservice=new PersonService(this.getContext());personservice.update(person);Person p=personservice.findbyid(1);Log.i(tag,p.toString());}public void testgetdatePerson(){Person p=new Person();PersonService personservice=new PersonService(this.getContext());List list=personservice.getdatePerson(0, 10);for(int i=0;i< p> p=(Person)list.get(i);Log.i(tag,p.toString());}}public void testgetcount(){PersonService personservice=new PersonService(this.getContext());long l=personservice.getcount();Log.i(tag, String.valueOf(l));}public void testdelete(){PersonService personservice=new PersonService(this.getContext());personservice.delete(1,2,3);}}

测试类代码

package eoe.demo;import java.util.List;import it.bean.Person;import it.service.PersonSQLservice;import android.test.AndroidTestCase;import android.util.Log;/**** 执行PersonSQLservice 进行测试**/public class PersonSQLserviceTest extends AndroidTestCase {private static final String TAG="PersonSQLserviceTest";public void testsave(){PersonSQLservice psql=new PersonSQLservice(this.getContext());for(int i=0;i<10;i++){psql.save(new Person("李渊", (short)1));}}public void testFind() throws Exception{PersonSQLservice psql=new PersonSQLservice(this.getContext());Person person = psql.find(22);Log.i(TAG, person.toString());}public void testUpdate() throws Exception{PersonSQLservice psql=new PersonSQLservice(this.getContext());Person person = psql.find(1);person.setName("liming");psql.update(person);//Log.i(TAG, person.toString());}public void testGetCount() throws Exception{PersonSQLservice psql=new PersonSQLservice(this.getContext());Log.i(TAG, String.valueOf(psql.getCount()));}public void testGetScrollData() throws Exception{PersonSQLservice psql=new PersonSQLservice(this.getContext());List persons = psql.getScrollData(0, 20);for(Person person : persons){Log.i(TAG, person.toString());}}public void testDelete() throws Exception{PersonSQLservice psql=new PersonSQLservice(this.getContext());psql.delete(1,2,3);}}


更多相关文章

  1. Android 代码片段
  2. 第一代Android壳源码--某某公司早期壳代码加固原理分析
  3. Android 滑动效果代码分享
  4. Android点击按钮实现全屏的代码
  5. Android开关机代码
  6. android 设置默认launcher 附上代码
  7. Android通过代码自动连接WiFi

随机推荐

  1. 大赞!分享一个数据科学利器 PyCaret,几行代
  2. 最近工程师怎么都在写公众号?这玩意到底能
  3. 如何实现本地代码和远程的实时同步
  4. 我不是盘神!PanDownload 作者被抓捕,一代神
  5. kubernetes高可用集群安装(二进制安装、v1
  6. 如何用Python,制作疫情可视化大屏?
  7. 太香了!推荐6个Python数据分析神器!!
  8. 用Python手写五大经典排序算法,看完这篇终
  9. 动态气泡图,拿走不谢!
  10. 谷歌家的验证码怎么了?搞他!