axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/test/encoding EncodingTest.java
Date Mon, 24 Nov 2003 21:50:18 GMT
dims        2003/11/24 13:50:18

  Modified:    java/test/encoding EncodingTest.java
  Log:
  Added test for french accents as well.
  
  Revision  Changes    Path
  1.5       +20 -0     ws-axis/java/test/encoding/EncodingTest.java
  
  Index: EncodingTest.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/EncodingTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EncodingTest.java	5 Oct 2003 07:10:02 -0000	1.4
  +++ EncodingTest.java	24 Nov 2003 21:50:18 -0000	1.5
  @@ -18,6 +18,7 @@
       private static final String SUPPORT_CHARS_LESS_HEX_20 = "\t\r\n";
       private static final String ENCODED_SUPPORT_CHARS_LESS_HEX_20 = "	
";
       private static final String INVALID_XML_STRING = "Invalid XML String \u0000";
  +    private static final String FRENCH_ACCENTS="\u00e0\u00e2\u00e4\u00e7\u00e8\u00e9\u00ea\u00eb\u00ee\u00ef\u00f4\u00f6\u00f9\u00fb\u00fc";
   
       public EncodingTest(String s) {
           super(s);
  @@ -90,6 +91,25 @@
       }
   
   
  +    public void test2UTF8() throws Exception {
  +        XMLEncoder encoder = XMLEncoderFactory.getEncoder(XMLEncoderFactory.ENCODING_UTF_8);
  +        String encodedAccents = encoder.encode(FRENCH_ACCENTS);
  +
  +        assertEquals(XMLEncoderFactory.ENCODING_UTF_8, encoder.getEncoding());
  +        assertEquals(FRENCH_ACCENTS, new String(encodedAccents.getBytes(), XMLEncoderFactory.ENCODING_UTF_8));
  +        verifyCommonAssertions(encoder);
  +    }
  +
  +    public void test2UTF16() throws Exception {
  +        XMLEncoder encoder = XMLEncoderFactory.getEncoder(XMLEncoderFactory.ENCODING_UTF_16);
  +        String encodedAccents = encoder.encode(FRENCH_ACCENTS);
  +
  +        assertEquals(XMLEncoderFactory.ENCODING_UTF_16, encoder.getEncoding());
  +        // java uses UTF-16 internally, should be equal
  +        assertEquals(FRENCH_ACCENTS, encodedAccents);
  +        verifyCommonAssertions(encoder);
  +    }
  +    
       /**
        * assertions here hold for either encoder
        * @param encoder
  
  
  

Mime
View raw message