use of com.webank.wedatasphere.qualitis.project.entity.Project in project Qualitis by WeBankFinTech.
the class ProjectUserRepositoryTest method test.
@Test
@Transactional
public void test() {
// 保存是否成功
Project project = new Project();
project.setName("junitProject");
project.setCreateUser("setCreateUser");
project.setCreateUserFullName("setCreateUserFullName");
project.setDescription("setDescription");
project.setUserDepartment("setUserDepartment");
Project saveProject = projectRepository.save(project);
assertTrue(saveProject.getId() != 0);
ProjectUser saveEntity = new ProjectUser(ProjectUserPermissionEnum.CREATOR.getCode(), project, "v_wblwyan_test", "颜龙武");
ProjectUser entity = repository.save(saveEntity);
// 根据username查询的数据库对象是否和保存的值一致
List<ProjectUser> findByUserNameList = repository.findByUserName(entity.getUserName());
assertTrue(findByUserNameList.size() > 0);
assertEquals(findByUserNameList.get(0).getUserName(), entity.getUserName());
// 删除后,是否还能找到对象
repository.deleteByProject(project);
List<ProjectUser> deleteEntity = repository.findByUserName(entity.getUserName());
assertTrue(deleteEntity.isEmpty());
}
Aggregations