Project

General

Profile

« Previous | Next » 

Revision 5745

Added by berkley almost 14 years ago

found a failure when using an InputStreamReader without an encoding

View differences:

test/edu/ucsb/nceas/metacattest/ReaderWriterTest.java
80 80
        suite.addTest(new ReaderWriterTest("testFileReaderAndWriter"));
81 81
        suite.addTest(new ReaderWriterTest("testBufferedReaderAndWriter"));
82 82
        suite.addTest(new ReaderWriterTest("charArrayReaderAndWriter"));
83
        suite.addTest(new ReaderWriterTest("testInputStreamReaderAndWriter"));
83 84
//        suite.addTest(new ReaderWriterTest("testBufferedReaderAndWriter"));
84 85
//        suite.addTest(new ReaderWriterTest("testBufferedReaderAndWriter"));
85 86
//        suite.addTest(new ReaderWriterTest("testBufferedReaderAndWriter"));
86 87
//        suite.addTest(new ReaderWriterTest("testBufferedReaderAndWriter"));
87
//        suite.addTest(new ReaderWriterTest("testBufferedReaderAndWriter"));
88 88
        
89 89
        return suite;
90 90
    }
91 91
    
92 92
    /**
93
     * test InputStreamReader and InputStreamWriter
94
     */
95
    public void testInputStreamReaderAndWriter()
96
    {
97
        try
98
        {
99
            File tmpFile = getTempFile();
100
            FileOutputStream fos = new FileOutputStream(tmpFile);
101
            fos.write(testStr.getBytes());
102
            fos.flush();
103
            fos.close();
104
            
105
            FileInputStream fis = new FileInputStream(tmpFile);
106
            InputStreamReader isr = new InputStreamReader(fis);
107
            String s = isr.toString();
108
            assertTrue(s.equals(testStr));
109
        }
110
        catch(Exception e)
111
        {
112
            fail("Unexpected error in testInputStreamReaderAndWriter: " + e.getMessage());
113
        }
114
    }
115
    
116
    /**
93 117
     * test FileReader and FileWriter
94 118
     */
95 119
    public void charArrayReaderAndWriter()
......
108 132
        }
109 133
        catch(Exception e)
110 134
        {
111
            fail("Unexpected error in testFileReaderAndWriter: " + e.getMessage());
135
            fail("Unexpected error in charArrayReaderAndWriter: " + e.getMessage());
112 136
        }
113 137
    }
114 138
    
......
133 157
        }
134 158
        catch(Exception e)
135 159
        {
136
            fail("Unexpected error in testFileReaderAndWriter: " + e.getMessage());
160
            fail("Unexpected error in testBufferedReaderAndWriter: " + e.getMessage());
137 161
        }
138 162
     
139 163
    }

Also available in: Unified diff