use of com.goku.demo.model.User in project springBoot-learn-demo by nbfujx.
the class UserRepositoryTest method test.
@Test
public void test() throws Exception {
// 创建三个User,并验证User总数
userRepository.save(new User(1L, "didi", 30));
userRepository.save(new User(2L, "mama", 40));
userRepository.save(new User(3L, "kaka", 50));
this.logger.info(String.valueOf(userRepository.findAll().size()));
// 删除一个User,再验证User总数
User u = userRepository.findOne(1L);
this.logger.info(u.toString());
userRepository.delete(u);
this.logger.info(String.valueOf(userRepository.findAll().size()));
// 删除一个User,再验证User总数
u = userRepository.findByUsername("mama");
this.logger.info(u.toString());
userRepository.delete(u);
this.logger.info(String.valueOf(userRepository.findAll().size()));
}
use of com.goku.demo.model.User in project springBoot-learn-demo by nbfujx.
the class UserRepositoryTest method test2.
@Test
public void test2() throws Exception {
// 创建三个User,并验证User总数
userRepository2.save(new User(1L, "didi22", 30));
userRepository2.save(new User(2L, "mama22", 40));
userRepository2.save(new User(3L, "kaka22", 50));
this.logger.info(String.valueOf(userRepository2.findAll().size()));
// 删除一个User,再验证User总数
User u = userRepository2.findOne(1L);
this.logger.info(u.toString());
userRepository2.delete(u);
this.logger.info(String.valueOf(userRepository2.findAll().size()));
// 删除一个User,再验证User总数
u = userRepository2.findByUsername("mama22");
this.logger.info(u.toString());
userRepository2.delete(u);
this.logger.info(String.valueOf(userRepository2.findAll().size()));
}
use of com.goku.demo.model.User in project springBoot-learn-demo by nbfujx.
the class UserRepositoryTest method test3.
@Test
public void test3() throws Exception {
Pageable pageable = new PageRequest(0, 10);
Page<User> u1 = userRepository.findByNameAndAgeRange("kaka", 50, pageable);
this.logger.info(u1.toString());
Page<User> u2 = userRepository.findByNameAndAgeRange2("kaka", 0, 50, pageable);
this.logger.info(u2.toString());
Page<User> u3 = userRepository.findByNameAndAgeRange3("kaka", 0, 50, pageable);
this.logger.info(u3.toString());
}
Aggregations