root/okpoll/src/net/okjsp/poll/PollTest.java

리비전 5, 1.0 kB (mefour에 의해 체크인됨, 16 년 전)

--

  • svn:mime-type 속성이 text/plain (으)로 설정되어있습니다.
Line 
1 package net.okjsp.poll;
2
3 import java.util.ArrayList;
4
5 import junit.framework.TestCase;
6
7 public class PollTest extends TestCase {
8        
9         public void testCreate() {
10                 Poll poll = new Poll();
11                 poll.setQuestion("좋아하는 색깔은?");
12                 assertEquals("좋아하는 색깔은?", poll.getQuestion());
13                 Poll poll2 = new Poll();
14                 poll2.setQuestion("성별은?");
15                 assertEquals("성별은?", poll2.getQuestion());
16         }
17        
18         public void testItems() {
19                 // to-do  나 무엇을 할 거야
20                 Poll poll = getPoll();
21                 assertEquals(2, poll.getItems().size());
22                 Item item = poll.getItems().get(1);
23                 assertEquals(1, item.getId());
24         }
25
26         private Poll getPoll() {
27                 Poll poll = new Poll();
28                 ArrayList<Item> items = new ArrayList<Item>();
29                 items.add(new Item("빨강"));
30                 items.add(new Item("노랑"));
31                 poll.setItems(items);
32                 return poll;
33         }
34        
35         public void testGetTotalCount() {
36                 Poll poll = getPoll();
37                 assertEquals(0, poll.getTotalCount());
38                 poll.getItems().get(1).increment();
39                 assertEquals(1, poll.getTotalCount());
40         }
41        
42 }
참고: 소스 브라우저를 사용하면서 도움이 필요하다면, TracBrowser를 참고하십시오.