OSDN Git Service

パッケージ名変更
[mikutoga/TogaGem.git] / src / test / java / jp / sfjp / mikutoga / pmd / RigidShapeTypeTest.java
1 /*
2  */
3
4 package jp.sfjp.mikutoga.pmd;
5
6 import java.util.Locale;
7 import org.junit.After;
8 import org.junit.AfterClass;
9 import org.junit.Before;
10 import org.junit.BeforeClass;
11 import org.junit.Test;
12 import static org.junit.Assert.*;
13
14 /**
15  *
16  */
17 public class RigidShapeTypeTest {
18
19     public RigidShapeTypeTest() {
20     }
21
22     @BeforeClass
23     public static void setUpClass() {
24     }
25
26     @AfterClass
27     public static void tearDownClass() {
28     }
29
30     @Before
31     public void setUp() {
32     }
33
34     @After
35     public void tearDown() {
36     }
37
38     /**
39      * Test of values method, of class RigidShapeType.
40      */
41     @Test
42     public void testValues() {
43         System.out.println("values");
44
45         RigidShapeType[] array = RigidShapeType.values();
46
47         assertEquals(3, array.length);
48
49         assertEquals(RigidShapeType.SPHERE,  array[0]);
50         assertEquals(RigidShapeType.BOX,     array[1]);
51         assertEquals(RigidShapeType.CAPSULE, array[2]);
52
53         return;
54     }
55
56     /**
57      * Test of decode method, of class RigidShapeType.
58      */
59     @Test
60     public void testDecode() {
61         System.out.println("decode");
62
63         assertEquals(RigidShapeType.SPHERE,  RigidShapeType.decode((byte)0x00));
64         assertEquals(RigidShapeType.BOX,     RigidShapeType.decode((byte)0x01));
65         assertEquals(RigidShapeType.CAPSULE, RigidShapeType.decode((byte)0x02));
66
67         assertNull(RigidShapeType.decode((byte)0x03));
68
69         return;
70     }
71
72     /**
73      * Test of encode method, of class RigidShapeType.
74      */
75     @Test
76     public void testEncode() {
77         System.out.println("encode");
78
79         assertEquals(0x00, RigidShapeType.SPHERE.encode());
80         assertEquals(0x01, RigidShapeType.BOX.encode());
81         assertEquals(0x02, RigidShapeType.CAPSULE.encode());
82
83         return;
84     }
85
86     /**
87      * Test of getGuiName method, of class RigidShapeType.
88      */
89     @Test
90     public void testGetGuiName_0args() {
91         System.out.println("getGuiName");
92
93         Locale locale = Locale.getDefault();
94
95         for(RigidShapeType type : RigidShapeType.values()){
96             assertEquals(type.getGuiName(locale), type.getGuiName());
97         }
98
99         return;
100     }
101
102     /**
103      * Test of getGuiName method, of class RigidShapeType.
104      */
105     @Test
106     public void testGetGuiName_Locale() {
107         System.out.println("getGuiName");
108
109         Locale locale;
110
111         locale = Locale.JAPANESE;
112         assertEquals("球",   RigidShapeType.SPHERE.getGuiName(locale));
113         assertEquals("箱",   RigidShapeType.BOX.getGuiName(locale));
114         assertEquals("カプセル",   RigidShapeType.CAPSULE.getGuiName(locale));
115
116         locale = Locale.JAPAN;
117         assertEquals("球",   RigidShapeType.SPHERE.getGuiName(locale));
118
119         locale = Locale.ITALY;
120         assertEquals("sphere",   RigidShapeType.SPHERE.getGuiName(locale));
121         assertEquals("box",      RigidShapeType.BOX.getGuiName(locale));
122         assertEquals("capsule",  RigidShapeType.CAPSULE.getGuiName(locale));
123
124         locale = Locale.ENGLISH;
125         assertEquals("sphere",   RigidShapeType.SPHERE.getGuiName(locale));
126
127         locale = Locale.US;
128         assertEquals("sphere",   RigidShapeType.SPHERE.getGuiName(locale));
129
130         return;
131     }
132
133 }