리비전 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 PollServiceTest extends TestCase { |
---|
8 |
PollService service; |
---|
9 |
@Override |
---|
10 |
protected void setUp() throws Exception { |
---|
11 |
service = new PollService(); |
---|
12 |
Poll poll = new Poll(); |
---|
13 |
ArrayList<Item> items = new ArrayList<Item>(); |
---|
14 |
items.add(new Item("빨강")); |
---|
15 |
items.add(new Item("노랑")); |
---|
16 |
poll.setItems(items); |
---|
17 |
|
---|
18 |
service.add(poll); |
---|
19 |
|
---|
20 |
poll = new Poll(); |
---|
21 |
service.add(poll); |
---|
22 |
} |
---|
23 |
|
---|
24 |
public void testAdd() { |
---|
25 |
assertEquals(2, service.getList().size()); |
---|
26 |
} |
---|
27 |
|
---|
28 |
public void test2Add() { |
---|
29 |
assertNotNull(service.getList().size()); |
---|
30 |
} |
---|
31 |
|
---|
32 |
public void testCountUp() { |
---|
33 |
int pollId = 0; |
---|
34 |
int itemId = 0; |
---|
35 |
service.countUp(pollId, itemId); |
---|
36 |
ArrayList<Item> items = service.get(pollId).getItems(); |
---|
37 |
assertEquals(2, items.size()); |
---|
38 |
Item item = items.get(itemId); |
---|
39 |
assertEquals(1, item.getCount()); |
---|
40 |
|
---|
41 |
service.countUp(pollId, itemId); |
---|
42 |
assertEquals(2, item.getCount()); |
---|
43 |
} |
---|
44 |
|
---|
45 |
} |
---|