You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by kl...@apache.org on 2004/06/09 19:50:06 UTC

cvs commit: jakarta-poi/src/testcases/org/apache/poi/hpsf/basic TestWrite.java

klute       2004/06/09 10:50:06

  Modified:    src/testcases/org/apache/poi/hpsf/basic TestWrite.java
  Log:
  - Maintainability increased by using symbolic names for constants.
  
  Revision  Changes    Path
  1.14      +16 -4     jakarta-poi/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
  
  Index: TestWrite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestWrite.java	9 Apr 2004 13:05:34 -0000	1.13
  +++ TestWrite.java	9 Jun 2004 17:50:06 -0000	1.14
  @@ -360,6 +360,13 @@
   
   
   
  +    private static final int CODEPAGE_DEFAULT = -1;
  +    private static final int CODEPAGE_UTF8 = 65001;
  +    private static final int CODEPAGE_UTF16 = 1200;
  +    private static final int CODEPAGE_1252 = 1252;
  +
  +
  +
       /**
        * <p>Writes and reads back various variant types and checks whether the
        * stuff that has been read back equals the stuff that was written.</p>
  @@ -367,7 +374,7 @@
       public void testVariantTypes()
       {
           Throwable t = null;
  -        final int codepage = -1;
  +        final int codepage = CODEPAGE_DEFAULT;
           try
           {
               check(Variant.VT_EMPTY, null, codepage);
  @@ -423,7 +430,8 @@
       public void testCodepages()
       {
           Throwable t = null;
  -        final int[] validCodepages = new int[] {-1, 1252, 1200, 65001};
  +        final int[] validCodepages = new int[]
  +            {CODEPAGE_DEFAULT, CODEPAGE_UTF8, CODEPAGE_UTF16, CODEPAGE_1252};
           for (int i = 0; i < validCodepages.length; i++)
           {
               int codepage = validCodepages[i];
  @@ -517,7 +525,11 @@
                        "index " + diff + ".");
           }
           else
  -            assertEquals(value, objRead);
  +            if (value != null && !value.equals(objRead))
  +                fail("Expected: \"" + value + "\" but was: \"" + objRead +
  +                     "\". Codepage: " + codepage + ".");
  +            else
  +                assertEquals(value, objRead);
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org