001 /*
002 * Copyright 2002 - 2010 JEuclid, http://jeuclid.sf.net
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 /* $Id: CharacterConverterTest.java,v 92b6a7c39d7f 2010/08/11 20:23:17 max $ */
018
019 package net.sourceforge.jeuclid.test;
020
021 import net.sourceforge.jeuclid.elements.support.text.CharConverter;
022
023 import org.junit.Assert;
024 import org.junit.Test;
025
026 /**
027 * @version $Revision: 92b6a7c39d7f $
028 */
029 public class CharacterConverterTest {
030 /**
031 * Default Constructor.
032 */
033 public CharacterConverterTest() {
034 // Empty on purpose
035 }
036
037 /**
038 * Tests late character conversion.
039 * @throws Exception if the test fails.
040 */
041 @Test
042 public void testLate() throws Exception {
043 Assert.assertEquals(CharConverter.convertLate("abcdef"), "abcdef");
044 Assert.assertEquals(CharConverter
045 .convertLate("x\u2061\u200b\u2062\u2148x"), "xx");
046 Assert.assertEquals(CharConverter.convertLate("\u0332"), "\u00AF");
047 }
048
049 /**
050 * Tests early character conversion.
051 * @throws Exception if the test fails.
052 */
053 @Test
054 public void testEarly() throws Exception {
055 Assert.assertEquals(CharConverter.convertEarly("abcdef"), "abcdef");
056 Assert.assertEquals(CharConverter.convertEarly("x\uE080x"), "x\u2031x");
057 }
058 }