}
@Test
public void testSave() {
Redis redis1 = new Redis(50);
Redis redis2 = new Redis(100);
Redis redis4 = new Redis(200);
Redis redis5 = null;
redis4.setId(4L);
try {
redis1 = RedisDAO.save(redis1);
redis2 = RedisDAO.save(redis2);
redis4 = RedisDAO.save(redis4);
redis5 = RedisDAO.save(redis5);
} catch (UserAlreadyExist e) {
fail();
}
assertEquals(50, redis1.getWeight());
assertEquals(100, redis2.getWeight());
assertEquals(200, redis4.getWeight());
assertEquals(new Long(1), redis1.getId());
assertEquals(new Long(2), redis2.getId());
assertEquals(new Long(4), redis4.getId());
Redis redis11 = RedisDAO.get(1L);
Redis redis12 = RedisDAO.get(2L);
Redis redis14 = RedisDAO.get(4L);
assertEquals(50, redis11.getWeight());
assertEquals(100, redis12.getWeight());
assertEquals(200, redis14.getWeight());
assertEquals(new Long(1), redis11.getId());
assertEquals(new Long(2), redis12.getId());
assertEquals(new Long(4), redis14.getId());
assertTrue(redis5 == null);
Redis redis3 = new Redis(75);
redis3.setId(2L);
try {
RedisDAO.save(redis3);
fail();
} catch (UserAlreadyExist e) {