use of org.neusoft.neubbs.entity.TopicReplyDO in project neubbs by nuitcoder.
the class TopicReplyDAOTest method testUpdateOpposeAddOneById.
/**
* 测试回复反对数(自动 +1)
*/
@Test
@Transactional
public void testUpdateOpposeAddOneById() {
TopicReplyDO reply = this.saveTestReplyToDatabase();
int replyId = reply.getId();
int beforeOppose = reply.getOppose();
Assert.assertEquals(1, topicReplyDAO.updateOpposeAddOneById(replyId));
int afterOppose = topicReplyDAO.getTopicReplyById(replyId).getOppose();
Assert.assertEquals(beforeOppose + 1, afterOppose);
System.out.println("update replyid=" + replyId + " reply oppose+1 success!");
}
use of org.neusoft.neubbs.entity.TopicReplyDO in project neubbs by nuitcoder.
the class TopicReplyDAOTest method testGetMaxTopicReplyId.
/**
* 测试获取最大的话题回复 id
*/
@Test
@Transactional
public void testGetMaxTopicReplyId() {
TopicReplyDO reply = this.saveTestReplyToDatabase();
Assert.assertEquals(reply.getId(), (Integer) topicReplyDAO.getMaxTopicReplyId());
System.out.println("success get max reply id");
}
use of org.neusoft.neubbs.entity.TopicReplyDO in project neubbs by nuitcoder.
the class TopicReplyDAOTest method testListTopicReplyByTopicId.
/**
* 测试获取指定 topicid 的所有回复
*/
@Test
@Transactional
public void testListTopicReplyByTopicId() {
TopicReplyDO reply = this.saveTestReplyToDatabase();
int topicId = reply.getTopicid();
List<TopicReplyDO> listTopicReply = topicReplyDAO.listTopicReplyByTopicId(topicId);
Assert.assertTrue(listTopicReply.size() >= 1);
int replyCount = 1;
for (TopicReplyDO topicReply : listTopicReply) {
System.out.println("ouput reply information (" + (replyCount++) + "): " + JsonUtil.toJsonString(topicReply));
}
System.out.println("success get topicid=" + topicId + " all reply list");
}
use of org.neusoft.neubbs.entity.TopicReplyDO in project neubbs by nuitcoder.
the class TopicReplyDAOTest method testUpdateContentByIdByContent.
/**
* 测试更新回复内容
*/
@Test
@Transactional
public void testUpdateContentByIdByContent() {
TopicReplyDO reply = this.saveTestReplyToDatabase();
int replyId = reply.getId();
String beforeContent = reply.getContent();
String newContent = "new reply content";
Assert.assertEquals(1, topicReplyDAO.updateContentByIdByContent(replyId, newContent));
String afterContent = topicReplyDAO.getTopicReplyById(replyId).getContent();
Assert.assertNotEquals(beforeContent, afterContent);
System.out.println("update replyid=" + replyId + " reply content=<" + newContent + "> success!");
}
use of org.neusoft.neubbs.entity.TopicReplyDO in project neubbs by nuitcoder.
the class TopicReplyDAOTest method testUpdateOpposeCutOneById.
/**
* 测试回复反对数(自动 -1)
*/
@Test
@Transactional
public void testUpdateOpposeCutOneById() {
TopicReplyDO reply = this.saveTestReplyToDatabase();
int replyId = reply.getId();
int beforeOppose = reply.getOppose();
Assert.assertEquals(1, topicReplyDAO.updateOpposeCutOneById(replyId));
int afterOppose = topicReplyDAO.getTopicReplyById(replyId).getOppose();
Assert.assertEquals(beforeOppose - 1, afterOppose);
System.out.println("update replyid=" + replyId + " reply oppose-1 success!");
}
Aggregations