OSDN Git Service

depend jiocema
[jindolf/JinParser.git] / src / test / java / jp / sourceforge / jindolf / parser / DecodeExceptionTest.java
1 /*
2  * License : The MIT License
3  * Copyright(c) 2009 olyutorskii
4  */
5
6 package jp.sourceforge.jindolf.parser;
7
8 import org.junit.After;
9 import org.junit.AfterClass;
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13
14 import static org.junit.Assert.*;
15
16 /**
17  */
18 public class DecodeExceptionTest {
19
20     public DecodeExceptionTest() {
21     }
22
23     @BeforeClass
24     public static void setUpClass() throws Exception{
25     }
26
27     @AfterClass
28     public static void tearDownClass() throws Exception{
29     }
30
31     @Before
32     public void setUp() {
33     }
34
35     @After
36     public void tearDown() {
37     }
38
39     /**
40      * Test of getBytePos method, of class DecodeException.
41      */
42     @Test
43     public void testGetBytePos(){
44         System.out.println("getBytePos");
45
46         DecodeException ex;
47
48         ex = new DecodeException();
49         assertTrue(0 > ex.getBytePos());
50
51         ex = new DecodeException("abc");
52         assertTrue(0 > ex.getBytePos());
53
54         ex = new DecodeException(10, 11);
55         assertEquals(10, ex.getBytePos());
56
57         ex = new DecodeException("abc", 10, 11);
58         assertEquals(10, ex.getBytePos());
59
60         return;
61     }
62
63     /**
64      * Test of getCharPos method, of class DecodeException.
65      */
66     @Test
67     public void testGetCharPos(){
68         System.out.println("getCharPos");
69
70         DecodeException ex;
71
72         ex = new DecodeException();
73         assertTrue(0 > ex.getCharPos());
74
75         ex = new DecodeException("abc");
76         assertTrue(0 > ex.getCharPos());
77
78         ex = new DecodeException(10, 11);
79         assertEquals(11, ex.getCharPos());
80
81         ex = new DecodeException("abc", 10, 11);
82         assertEquals(11, ex.getCharPos());
83
84         return;
85     }
86
87     /**
88      * Test of getMessage method, of class DecodeException.
89      */
90     @Test
91     public void testGetMessage(){
92         System.out.println("getMessage");
93
94         DecodeException ex;
95
96         ex = new DecodeException();
97         assertEquals("bytePos=-1 charPos=-1", ex.getMessage());
98
99         ex = new DecodeException("abc");
100         assertEquals("abc bytePos=-1 charPos=-1", ex.getMessage());
101
102         ex = new DecodeException(10, 11);
103         assertEquals("bytePos=10 charPos=11", ex.getMessage());
104
105         ex = new DecodeException("abc", 10, 11);
106         assertEquals("abc bytePos=10 charPos=11", ex.getMessage());
107
108         return;
109     }
110
111 }