2 * License : The MIT License
3 * Copyright(c) 2009 olyutorskii
6 package jp.sourceforge.jindolf.parser;
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.*;
17 public class DecodeExceptionTest {
19 public DecodeExceptionTest() {
23 public static void setUpClass() throws Exception{
27 public static void tearDownClass() throws Exception{
35 public void tearDown() {
39 * Test of getBytePos method, of class DecodeException.
42 public void testGetBytePos(){
43 System.out.println("getBytePos");
47 ex = new DecodeException();
48 assertTrue(0 > ex.getBytePos());
50 ex = new DecodeException("abc");
51 assertTrue(0 > ex.getBytePos());
53 ex = new DecodeException(10, 11);
54 assertEquals(10, ex.getBytePos());
56 ex = new DecodeException("abc", 10, 11);
57 assertEquals(10, ex.getBytePos());
63 * Test of getCharPos method, of class DecodeException.
66 public void testGetCharPos(){
67 System.out.println("getCharPos");
71 ex = new DecodeException();
72 assertTrue(0 > ex.getCharPos());
74 ex = new DecodeException("abc");
75 assertTrue(0 > ex.getCharPos());
77 ex = new DecodeException(10, 11);
78 assertEquals(11, ex.getCharPos());
80 ex = new DecodeException("abc", 10, 11);
81 assertEquals(11, ex.getCharPos());
87 * Test of getMessage method, of class DecodeException.
90 public void testGetMessage(){
91 System.out.println("getMessage");
95 ex = new DecodeException();
96 assertEquals("bytePos=-1 charPos=-1", ex.getMessage());
98 ex = new DecodeException("abc");
99 assertEquals("abc bytePos=-1 charPos=-1", ex.getMessage());
101 ex = new DecodeException(10, 11);
102 assertEquals("bytePos=10 charPos=11", ex.getMessage());
104 ex = new DecodeException("abc", 10, 11);
105 assertEquals("abc bytePos=10 charPos=11", ex.getMessage());