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;
14 import static org.junit.Assert.*;
18 public class DecodeExceptionTest {
20 public DecodeExceptionTest() {
24 public static void setUpClass() throws Exception{
28 public static void tearDownClass() throws Exception{
36 public void tearDown() {
40 * Test of getBytePos method, of class DecodeException.
43 public void testGetBytePos(){
44 System.out.println("getBytePos");
48 ex = new DecodeException();
49 assertTrue(0 > ex.getBytePos());
51 ex = new DecodeException("abc");
52 assertTrue(0 > ex.getBytePos());
54 ex = new DecodeException(10, 11);
55 assertEquals(10, ex.getBytePos());
57 ex = new DecodeException("abc", 10, 11);
58 assertEquals(10, ex.getBytePos());
64 * Test of getCharPos method, of class DecodeException.
67 public void testGetCharPos(){
68 System.out.println("getCharPos");
72 ex = new DecodeException();
73 assertTrue(0 > ex.getCharPos());
75 ex = new DecodeException("abc");
76 assertTrue(0 > ex.getCharPos());
78 ex = new DecodeException(10, 11);
79 assertEquals(11, ex.getCharPos());
81 ex = new DecodeException("abc", 10, 11);
82 assertEquals(11, ex.getCharPos());
88 * Test of getMessage method, of class DecodeException.
91 public void testGetMessage(){
92 System.out.println("getMessage");
96 ex = new DecodeException();
97 assertEquals("bytePos=-1 charPos=-1", ex.getMessage());
99 ex = new DecodeException("abc");
100 assertEquals("abc bytePos=-1 charPos=-1", ex.getMessage());
102 ex = new DecodeException(10, 11);
103 assertEquals("bytePos=10 charPos=11", ex.getMessage());
105 ex = new DecodeException("abc", 10, 11);
106 assertEquals("abc bytePos=10 charPos=11", ex.getMessage());