001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.commons.codec;
019
020 import org.junit.Assert;
021
022 import org.junit.Test;
023
024 /**
025 * Sanity checks for {@link CharEncoding}.
026 *
027 * @version $Id: CharEncodingTest.html 889935 2013-12-11 05:05:13Z ggregory $
028 */
029 public class CharEncodingTest {
030
031 /**
032 * We could make the constructor private in the future, it's a matter a style.
033 */
034 @Test
035 public void testConstructor() {
036 new CharEncoding();
037 }
038
039 @Test
040 public void testIso8859_1() {
041 Assert.assertEquals("ISO-8859-1", CharEncoding.ISO_8859_1);
042 }
043
044 @Test
045 public void testUsAscii() {
046 Assert.assertEquals("US-ASCII", CharEncoding.US_ASCII);
047 }
048
049 @Test
050 public void testUtf16() {
051 Assert.assertEquals("UTF-16", CharEncoding.UTF_16);
052 }
053
054 @Test
055 public void testUtf16Be() {
056 Assert.assertEquals("UTF-16BE", CharEncoding.UTF_16BE);
057 }
058
059 @Test
060 public void testUtf16Le() {
061 Assert.assertEquals("UTF-16LE", CharEncoding.UTF_16LE);
062 }
063
064 @Test
065 public void testUtf8() {
066 Assert.assertEquals("UTF-8", CharEncoding.UTF_8);
067 }
068
069 }