/*
 * StringConvertExceptionTest class.
 *
 * Copyright (C) 2007 SATOH Takayuki All Rights Reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package ts.util.text;

import ts.tester.function.coverage.FunctionTester;
import ts.tester.function.print.*;

/**
 * <code>StringConvertException</code>クラスの機能試験クラス。
 *
 * @author  佐藤隆之. 
 * @version $Revision: 1.1.1.1 $, $Date: 2010-10-16 00:03:53 $
 */
public class StringConvertExceptionTest extends FunctionTester
{
  public static void main(String[] args)
  {
    try {
      PrinterGroup group = new PrinterGroup();
      group.addPrinter(new ConsolePrinter());
      group.addPrinter(new HtmlPrinter("SATOH Takayuki"));
      setPrinter(group);

      run(StringConvertExceptionTest.class, (args.length == 0) ? null : args[0]);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  /* -- test case -- */

  public void constructor_index_string()
  {
    MSG("通常の操作");

    try {
      throw new StringConvertException(123, "aaa");
    } catch (StringConvertException e) {
      EQUAL(e.getMessage(), null);
      EQUAL(e.getStoppedIndex(), 123);
      EQUAL(e.convertedString(), "aaa");
      EQUAL(e.toString(), e.getClass().getName());
    }
  }

  public void constructor_index_string_message()
  {
    MSG("通常の操作");

    try {
      throw new StringConvertException(123, "aaa", "bbb");
    } catch (StringConvertException e) {
      EQUAL(e.getMessage(), "bbb");
      EQUAL(e.getStoppedIndex(), 123);
      EQUAL(e.convertedString(), "aaa");
      EQUAL(e.toString(), e.getClass().getName() + ": bbb");
    }

    try {
      throw new StringConvertException(123, "aaa", (String) null);
    } catch (StringConvertException e) {
      EQUAL(e.getMessage(), null);
      EQUAL(e.getStoppedIndex(), 123);
      EQUAL(e.convertedString(), "aaa");
      EQUAL(e.toString(), e.getClass().getName());
    }
  }
}
