forked from sommer1991/javaWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommentTest.java
More file actions
40 lines (34 loc) · 1.04 KB
/
Copy pathCommentTest.java
File metadata and controls
40 lines (34 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package webproject;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.weibo.dashboard.entity.Comment;
import com.weibo.dashboard.entity.Post;
import com.weibo.dashboard.service.CommentService;
import com.weibo.dashboard.service.PostService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:conf/spring-mybatis.xml"})
public class CommentTest {
@Resource
CommentService commentservice;
/*@Test
public void testFindList(){
List<Post> list = commentservice.findList();
for (Post post : list) {
System.out.println(post.getAuthorName());
}
}*/
@Test
public void testAdd(){
Comment comment = new Comment();
comment.setcContent("good");
comment.setcAuthorName("sommer");
comment.setPostId(2);
int res = commentservice.insert(comment);
System.out.println(res);
}
}