我使用greendao 1.3.1生成了一个类和测试 一切看起来都不错;但是,我无法运行生成的dao测试。引发了一个java.lang.RuntimeException,指出“找不到测试类”。我的其他Android测试用例运行得很好。
以下是生成的代码:
package com.amec.amecsurvey.test;
import de.greenrobot.dao.test.AbstractDaoTestLongPk;
import com.amec.amecsurvey.entities.Project;
import com.amec.amecsurvey.persistence.ProjectDao;
public class ProjectTest extends AbstractDaoTestLongPk<ProjectDao, Project> {
public ProjectTest() {
super(ProjectDao.class);
}
public void testProjectDao() throws Exception{
ProjectTest test = new ProjectTest();
Project project = test.createEntity(1l);
project.generateUUID();
project.setProjectNumber("CCTEST");
project.setName("Test Project");
test.dao.insert(project);
project = dao.load(1l);
assertNotNull(project);
Project dbProject = dao.load(1l);
assertTrue(project.equals(dbProject));
}
@Override
protected Project createEntity(Long key) {
Project entity = new Project();
entity.setId(key);
return entity;
}
}