Index: C:/workspace/axis1/test/org/apache/axis/components/encoding/UTF8EncoderTest.java =================================================================== --- C:/workspace/axis1/test/org/apache/axis/components/encoding/UTF8EncoderTest.java (revision 0) +++ C:/workspace/axis1/test/org/apache/axis/components/encoding/UTF8EncoderTest.java (revision 0) @@ -0,0 +1,85 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.axis.components.encoding; + +import java.io.IOException; +import java.io.StringWriter; + +import junit.framework.TestCase; + +/** + * Test UTF8Encoder. + * + * @author Christian Mueller + */ +public class UTF8EncoderTest extends TestCase { + + private UTF8Encoder encoder; + + public UTF8EncoderTest(String name) { + super(name); + } + + /** + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + + this.encoder = new UTF8Encoder(); + } + + /** + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + + this.encoder = null; + } + + /** + * Test method for 'org.apache.axis.components.encoding.UTF8Encoder.getEncoding()' + */ + public void testGetEncoding() { + assertEquals("UTF-8", this.encoder.getEncoding()); + } + + /** + * Test method for 'org.apache.axis.components.encoding.UTF8Encoder.writeEncoded(Writer, String)' + * @throws IOException + */ + public void testWriteEncoded() throws IOException { + StringWriter writer = new StringWriter(); + this.encoder.writeEncoded(writer, "a A 1"); + + assertEquals("a A 1", writer.getBuffer().toString()); + + // + + writer = new StringWriter(); + this.encoder.writeEncoded(writer, "& \" < > \n \r \t"); + + assertEquals("& " < > \n \r \t", writer.getBuffer().toString()); + + // + + writer = new StringWriter(); + this.encoder.writeEncoded(writer, "ä ö ü ß Ä Ö Ü"); + + assertEquals("ä ö ü ß Ä Ö Ü", writer.getBuffer().toString()); + } +}