OSDN Git Service

改行コード指定
[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 import static org.junit.Assert.*;
14
15 /**
16  */
17 public class DecodeExceptionTest {
18
19     public DecodeExceptionTest() {
20     }
21
22     @BeforeClass
23     public static void setUpClass() throws Exception{
24     }
25
26     @AfterClass
27     public static void tearDownClass() throws Exception{
28     }
29
30     @Before
31     public void setUp() {
32     }
33
34     @After
35     public void tearDown() {
36     }
37
38     /**
39      * Test of getBytePos method, of class DecodeException.
40      */
41     @Test
42     public void testGetBytePos(){
43         System.out.println("getBytePos");
44
45         DecodeException ex;
46
47         ex = new DecodeException();
48         assertTrue(0 > ex.getBytePos());
49
50         ex = new DecodeException("abc");
51         assertTrue(0 > ex.getBytePos());
52
53         ex = new DecodeException(10, 11);
54         assertEquals(10, ex.getBytePos());
55
56         ex = new DecodeException("abc", 10, 11);
57         assertEquals(10, ex.getBytePos());
58
59         return;
60     }
61
62     /**
63      * Test of getCharPos method, of class DecodeException.
64      */
65     @Test
66     public void testGetCharPos(){
67         System.out.println("getCharPos");
68
69         DecodeException ex;
70
71         ex = new DecodeException();
72         assertTrue(0 > ex.getCharPos());
73
74         ex = new DecodeException("abc");
75         assertTrue(0 > ex.getCharPos());
76
77         ex = new DecodeException(10, 11);
78         assertEquals(11, ex.getCharPos());
79
80         ex = new DecodeException("abc", 10, 11);
81         assertEquals(11, ex.getCharPos());
82
83         return;
84     }
85
86     /**
87      * Test of getMessage method, of class DecodeException.
88      */
89     @Test
90     public void testGetMessage(){
91         System.out.println("getMessage");
92
93         DecodeException ex;
94
95         ex = new DecodeException();
96         assertEquals("bytePos=-1 charPos=-1", ex.getMessage());
97
98         ex = new DecodeException("abc");
99         assertEquals("abc bytePos=-1 charPos=-1", ex.getMessage());
100
101         ex = new DecodeException(10, 11);
102         assertEquals("bytePos=10 charPos=11", ex.getMessage());
103
104         ex = new DecodeException("abc", 10, 11);
105         assertEquals("abc bytePos=10 charPos=11", ex.getMessage());
106
107         return;
108     }
109
110 }