Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/NullReaderTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -107,7 +107,7 @@ public class NullReaderTest extends Test // reset by closing reader.close(); - + // Read into array using offset & length final int offset = 2; final int lth = 4; @@ -142,7 +142,7 @@ public class NullReaderTest extends Test int position = 0; final int readlimit = 10; final Reader reader = new TestNullReader(100, true, false); - + assertTrue("Mark Should be Supported", reader.markSupported()); // No Mark @@ -255,6 +255,6 @@ public class NullReaderTest extends Test chars[i] = (char)(startPos + i); } } - + } }
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -30,7 +30,7 @@ import org.junit.Test; public class ReaderInputStreamTest { private static final String TEST_STRING = "\u00e0 peine arriv\u00e9s nous entr\u00e2mes dans sa chambre"; private static final String LARGE_TEST_STRING; - + static { final StringBuilder buffer = new StringBuilder(); for (int i=0; i<100; i++) { @@ -38,9 +38,9 @@ public class ReaderInputStreamTest { } LARGE_TEST_STRING = buffer.toString(); } - + private final Random random = new Random(); - + private void testWithSingleByteRead(final String testString, final String charsetName) throws IOException { final byte[] bytes = testString.getBytes(charsetName); final ReaderInputStream in = new ReaderInputStream(new StringReader(testString), charsetName); @@ -53,7 +53,7 @@ public class ReaderInputStreamTest { assertEquals(-1, in.read()); in.close(); } - + private void testWithBufferedRead(final String testString, final String charsetName) throws IOException { final byte[] expected = testString.getBytes(charsetName); final ReaderInputStream in = new ReaderInputStream(new StringReader(testString), charsetName); @@ -79,32 +79,32 @@ public class ReaderInputStreamTest { } in.close(); } - + @Test public void testUTF8WithSingleByteRead() throws IOException { testWithSingleByteRead(TEST_STRING, "UTF-8"); } - + @Test public void testLargeUTF8WithSingleByteRead() throws IOException { testWithSingleByteRead(LARGE_TEST_STRING, "UTF-8"); } - + @Test public void testUTF8WithBufferedRead() throws IOException { testWithBufferedRead(TEST_STRING, "UTF-8"); } - + @Test public void testLargeUTF8WithBufferedRead() throws IOException { testWithBufferedRead(LARGE_TEST_STRING, "UTF-8"); } - + @Test public void testUTF16WithSingleByteRead() throws IOException { testWithSingleByteRead(TEST_STRING, "UTF-16"); } - + @SuppressWarnings("deprecation") @Test public void testReadZero() throws Exception { @@ -117,7 +117,7 @@ public class ReaderInputStreamTest { assertEquals(0, r.read(bytes, 0, 0)); r.close(); } - + @SuppressWarnings("deprecation") @Test public void testReadZeroEmptyString() throws Exception { @@ -130,10 +130,10 @@ public class ReaderInputStreamTest { assertEquals(-1, r.read(bytes, 0, 1)); r.close(); } - + /** * Tests https://issues.apache.org/jira/browse/IO-277 - * + * * @throws IOException */ @Test Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java Wed Apr 24 23:20:29 2013 @@ -208,7 +208,7 @@ public class XmlStreamReaderTest { _testHttpInvalid("application/xml;charset=UTF-16BE", "UTF-16BE-bom", "UTF-16BE", null); _testHttpInvalid("application/xml;charset=UTF-16BE", "UTF-16BE-bom", "UTF-16BE", "UTF-16"); _testHttpInvalid("application/xml;charset=UTF-16BE", "UTF-16BE-bom", "UTF-16BE", "UTF-16BE"); - + _testHttpInvalid("application/xml;charset=UTF-32BE", "UTF-32BE-bom", "UTF-32BE", null); _testHttpInvalid("application/xml;charset=UTF-32BE", "UTF-32BE-bom", "UTF-32BE", "UTF-32"); _testHttpInvalid("application/xml;charset=UTF-32BE", "UTF-32BE-bom", "UTF-32BE", "UTF-32BE"); @@ -278,7 +278,7 @@ public class XmlStreamReaderTest { _testHttpLenient("text/html;charset=UTF-16BE", "no-bom", "US-ASCII", "UTF-8", "UTF-8"); _testHttpLenient("text/html;charset=UTF-32BE", "no-bom", "US-ASCII", "UTF-8", "UTF-8"); } - + @Test public void testRawContent() throws Exception { final String encoding = "UTF-8"; Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -81,7 +81,7 @@ public class XmlStreamReaderUtilitiesTes checkContentTypeMime("application/xml", "application/xml;charset=utf-16"); checkContentTypeMime("application/xml", "application/xml;charset=utf-32"); } - + private void checkContentTypeMime(final String expected, final String httpContentType) { assertEquals("ContentTypeMime=[" + httpContentType + "]", expected, XmlStreamReader.getContentTypeMime(httpContentType)); } @@ -102,7 +102,7 @@ public class XmlStreamReaderUtilitiesTes checkAppXml(true, "application/xml-dtd"); checkAppXml(true, "application/xml-external-parsed-entity"); } - + @SuppressWarnings("boxing") private void checkAppXml(final boolean expected, final String mime) { assertEquals("Mime=[" + mime + "]", expected, XmlStreamReader.isAppXml(mime)); @@ -121,7 +121,7 @@ public class XmlStreamReaderUtilitiesTes checkTextXml(false, "application/xml"); checkTextXml(false, "application/atom+xml"); } - + @SuppressWarnings("boxing") private void checkTextXml(final boolean expected, final String mime) { assertEquals("Mime=[" + mime + "]", expected, XmlStreamReader.isTextXml(mime)); @@ -154,7 +154,7 @@ public class XmlStreamReaderUtilitiesTes testCalculateRawEncodingStandard("UTF-16BE", "UTF-8", "UTF-16LE"); testCalculateRawEncodingStandard("UTF-16LE", "UTF-8", "UTF-16BE"); } - + /** BOM calculateRawEncoding() Test */ @Test //@Ignore @@ -164,7 +164,7 @@ public class XmlStreamReaderUtilitiesTes testCalculateRawEncodingStandard("UTF-32BE", "UTF-8", "UTF-32LE"); testCalculateRawEncodingStandard("UTF-32LE", "UTF-8", "UTF-32BE"); } - + private void testCalculateRawEncodingStandard(final String bomEnc, final String otherEnc, final String defaultEnc) throws IOException { // Expected BOM Guess XMLEnc Default checkRawEncoding(bomEnc, bomEnc, null, null, defaultEnc); @@ -193,7 +193,7 @@ public class XmlStreamReaderUtilitiesTes checkRawError(RAWMGS1, "UTF-16LE", null, "UTF-16BE", null); checkRawError(RAWMGS1, "UTF-16LE", "UTF-16LE", "UTF-16BE", null); } - + /** Additional UTF-32 calculateRawEncoding() Test */ @Test public void testCalculateRawEncodingAdditonalUTF32() throws IOException { @@ -209,7 +209,7 @@ public class XmlStreamReaderUtilitiesTes checkRawError(RAWMGS1, "UTF-32LE", null, "UTF-32BE", null); checkRawError(RAWMGS1, "UTF-32LE", "UTF-32LE", "UTF-32BE", null); } - + private void checkRawEncoding(final String expected, final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) throws IOException { final StringBuilder builder = new StringBuilder(); @@ -221,7 +221,7 @@ public class XmlStreamReaderUtilitiesTes final String encoding = calculateRawEncoding(bomEnc,xmlGuessEnc,xmlEnc, defaultEncoding); assertEquals(builder.toString(), expected, encoding); } - + protected String calculateRawEncoding(final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) throws IOException { final MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding); @@ -229,7 +229,7 @@ public class XmlStreamReaderUtilitiesTes mock.close(); return enc; } - + private void checkRawError(final String msgSuffix, final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) { try { @@ -273,7 +273,7 @@ public class XmlStreamReaderUtilitiesTes checkHttpEncoding("UTF-8", false, APPXML_UTF8, null, null, null, null); checkHttpEncoding("UTF-8", false, APPXML_UTF8, "UTF-16BE", "UTF-16BE", "UTF-16BE", "UTF-16BE"); } - + /** Test calculate HTTP Encoding */ @Test //@Ignore @@ -292,7 +292,7 @@ public class XmlStreamReaderUtilitiesTes checkHttpEncoding("UTF-32BE", false, APPXML_UTF32, "UTF-32BE", null, null, null); checkHttpEncoding("UTF-8", false, APPXML_UTF8, "UTF-32BE", "UTF-32BE", "UTF-32BE", "UTF-32BE"); } - + private void checkHttpEncoding(final String expected, final boolean lenient, final String httpContentType, final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) throws IOException { final StringBuilder builder = new StringBuilder(); @@ -306,7 +306,7 @@ public class XmlStreamReaderUtilitiesTes final String encoding = calculateHttpEncoding(httpContentType, bomEnc, xmlGuessEnc, xmlEnc, lenient, defaultEncoding); assertEquals(builder.toString(), expected, encoding); } - + protected String calculateHttpEncoding(final String httpContentType, final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final boolean lenient, final String defaultEncoding) throws IOException { final MockXmlStreamReader mock = new MockXmlStreamReader(defaultEncoding); @@ -314,7 +314,7 @@ public class XmlStreamReaderUtilitiesTes mock.close(); return enc; } - + private void checkHttpError(final String msgSuffix, final boolean lenient, final String httpContentType, final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final String defaultEncoding) { try { Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/AbstractMonitorTestCase.java Wed Apr 24 23:20:29 2013 @@ -67,19 +67,19 @@ public abstract class AbstractMonitorTes final IOFileFilter files = FileFilterUtils.fileFileFilter(); final IOFileFilter javaSuffix = FileFilterUtils.suffixFileFilter(".java"); final IOFileFilter fileFilter = FileFilterUtils.and(files, javaSuffix); - + final IOFileFilter directories = FileFilterUtils.directoryFileFilter(); final IOFileFilter visible = HiddenFileFilter.VISIBLE; final IOFileFilter dirFilter = FileFilterUtils.and(directories, visible); final IOFileFilter filter = FileFilterUtils.or(dirFilter, fileFilter); - + createObserver(testDir, filter); } /** * Create a {@link FileAlterationObserver}. - * + * * @param file The directory to observe * @param fileFilter The file filter to apply */ Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationMonitorTestCase.java Wed Apr 24 23:20:29 2013 @@ -56,7 +56,7 @@ public class FileAlterationMonitorTestCa public void testAddRemoveObservers() { FileAlterationObserver[] observers = null; FileAlterationMonitor monitor = null; - + // Null Observers monitor = new FileAlterationMonitor(123, observers); assertEquals("Interval", 123, monitor.getInterval()); Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTestCase.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/monitor/FileAlterationObserverTestCase.java Wed Apr 24 23:20:29 2013 @@ -79,7 +79,7 @@ public class FileAlterationObserverTestC observer = new FileAlterationObserver(file); assertEquals("FileAlterationObserver[file='" + file.getPath() + "', listeners=0]", observer.toString()); - + observer = new FileAlterationObserver(file, CanReadFileFilter.CAN_READ); assertEquals("FileAlterationObserver[file='" + file.getPath() + "', CanReadFileFilter, listeners=0]", observer.toString()); @@ -105,7 +105,7 @@ public class FileAlterationObserverTestC final File testDirAFile3 = touch(new File(testDirA, "A-file3.java")); File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); final File testDirBFile1 = touch(new File(testDirB, "B-file1.java")); - + checkAndNotify(); checkCollectionSizes("B", 3, 0, 0, 4, 0, 0); assertTrue("B testDirA", listener.getCreatedDirectories().contains(testDirA)); @@ -136,7 +136,7 @@ public class FileAlterationObserverTestC assertFalse("E testDirAFile2", listener.getDeletedFiles().contains(testDirAFile2)); assertTrue("E testDirAFile3", listener.getDeletedFiles().contains(testDirAFile3)); assertTrue("E testDirAFile4", listener.getDeletedFiles().contains(testDirAFile4)); - + testDir.mkdir(); checkAndNotify(); checkCollectionsEmpty("F"); @@ -165,7 +165,7 @@ public class FileAlterationObserverTestC File testDirAFile3 = new File(testDirA, "A-file3.java"); final File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); File testDirAFile5 = new File(testDirA, "A-file5.java"); - + checkAndNotify(); checkCollectionSizes("B", 1, 0, 0, 2, 0, 0); assertFalse("B testDirAFile1", listener.getCreatedFiles().contains(testDirAFile1)); @@ -227,7 +227,7 @@ public class FileAlterationObserverTestC File testDirAFile3 = touch(new File(testDirA, "A-file3.java")); final File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); File testDirAFile5 = touch(new File(testDirA, "A-file5.java")); - + checkAndNotify(); checkCollectionSizes("B", 1, 0, 0, 5, 0, 0); assertTrue("B testDirAFile1", listener.getCreatedFiles().contains(testDirAFile1)); Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTestCase.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -30,7 +30,7 @@ import junit.framework.TestCase; public class ByteArrayOutputStreamTestCase extends TestCase { private static final byte[] DATA; - + static { DATA = new byte[64]; for (byte i = 0; i < 64; i++) { @@ -42,7 +42,7 @@ public class ByteArrayOutputStreamTestCa super(name); } - private int writeData(final ByteArrayOutputStream baout, + private int writeData(final ByteArrayOutputStream baout, final java.io.ByteArrayOutputStream ref, final int count) { if (count > DATA.length) { @@ -58,9 +58,9 @@ public class ByteArrayOutputStreamTestCa return count; } } - - private int writeData(final ByteArrayOutputStream baout, - final java.io.ByteArrayOutputStream ref, + + private int writeData(final ByteArrayOutputStream baout, + final java.io.ByteArrayOutputStream ref, final int[] instructions) { int written = 0; for (final int instruction : instructions) { @@ -156,15 +156,15 @@ public class ByteArrayOutputStreamTestCa assertEquals(30, baoutData.length); checkByteArrays(refData, baoutData); } - + public void testStream() throws Exception { int written; - + //The ByteArrayOutputStream is initialized with 32 bytes to match //the original more closely for this test. final ByteArrayOutputStream baout = new ByteArrayOutputStream(32); final java.io.ByteArrayOutputStream ref = new java.io.ByteArrayOutputStream(); - + //First three writes written = writeData(baout, ref, new int[] {4, 10, 22}); assertEquals(36, written); @@ -175,10 +175,10 @@ public class ByteArrayOutputStreamTestCa assertEquals(32, written); checkStreams(baout, ref); - //Now reset the streams + //Now reset the streams baout.reset(); ref.reset(); - + //Test again to see if reset() had any bad effects written = writeData(baout, ref, new int[] {5, 47, 33, 60, 1, 0, 8}); assertEquals(155, written); @@ -190,19 +190,19 @@ public class ByteArrayOutputStreamTestCa assertEquals(155, written); checkStreams(baout, ref); - //Write the commons Byte[]OutputStream to a java.io.Byte[]OutputStream + //Write the commons Byte[]OutputStream to a java.io.Byte[]OutputStream //and vice-versa to test the writeTo() method. final ByteArrayOutputStream baout1 = new ByteArrayOutputStream(32); ref.writeTo(baout1); final java.io.ByteArrayOutputStream ref1 = new java.io.ByteArrayOutputStream(); baout.writeTo(ref1); checkStreams(baout1, ref1); - + //Testing toString(String) final String baoutString = baout.toString("ASCII"); final String refString = ref.toString("ASCII"); assertEquals("ASCII decoded String must be equal", refString, baoutString); - + //Make sure that empty ByteArrayOutputStreams really don't create garbage //on toByteArray() final ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -162,7 +162,7 @@ public class DeferredFileOutputStreamTes // Ensure that the test starts from a clean base. testFile.delete(); } - + /** * Test wether writeTo() properly writes small content. @@ -180,14 +180,14 @@ public class DeferredFileOutputStreamTes assertFalse(testFile.exists()); assertTrue(dfos.isInMemory()); - + try { dfos.writeTo(baos); fail("Should not have been able to write before closing"); } catch (final IOException ioe) { // ok, as expected } - + dfos.close(); dfos.writeTo(baos); } catch (final IOException ioe) { @@ -215,14 +215,14 @@ public class DeferredFileOutputStreamTes assertTrue(testFile.exists()); assertFalse(dfos.isInMemory()); - + try { dfos.writeTo(baos); fail("Should not have been able to write before closeing"); } catch (final IOException ioe) { // ok, as expected } - + dfos.close(); dfos.writeTo(baos); } catch (final IOException ioe) { Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/FileWriterWithEncodingTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -83,14 +83,14 @@ public class FileWriterWithEncodingTest fw2 = new FileWriterWithEncoding(file2, defaultEncoding); assertTrue(file1.exists()); assertTrue(file2.exists()); - + fw1.write(textContent); fw2.write(textContent); - + fw1.flush(); fw2.flush(); checkFile(file1, file2); - + } finally { IOUtils.closeQuietly(fw1); IOUtils.closeQuietly(fw2); @@ -108,10 +108,10 @@ public class FileWriterWithEncodingTest fw2 = new FileWriterWithEncoding(file2, defaultEncoding); assertTrue(file1.exists()); assertTrue(file2.exists()); - + fw1.write(textContent); fw2.write(textContent); - + fw1.flush(); fw2.flush(); try { @@ -120,7 +120,7 @@ public class FileWriterWithEncodingTest } catch (final AssertionFailedError ex) { // success } - + } finally { IOUtils.closeQuietly(fw1); IOUtils.closeQuietly(fw2); @@ -136,10 +136,10 @@ public class FileWriterWithEncodingTest fw2 = new FileWriterWithEncoding(file2, defaultEncoding); assertTrue(file1.exists()); assertTrue(file2.exists()); - + fw1.write(textContent); fw2.write(textContent); - + fw1.flush(); fw2.flush(); try { @@ -148,7 +148,7 @@ public class FileWriterWithEncodingTest } catch (final AssertionFailedError ex) { // success } - + } finally { IOUtils.closeQuietly(fw1); IOUtils.closeQuietly(fw2); Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/LockableFileWriterTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -26,8 +26,8 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.io.testtools.FileBasedTestCase; /** - * Tests that files really lock, although no writing is done as - * the locking is tested only on construction. + * Tests that files really lock, although no writing is done as + * the locking is tested only on construction. * * @version $Id$ */ @@ -69,31 +69,31 @@ public class LockableFileWriterTest exte lfw1 = new LockableFileWriter(file); assertTrue(file.exists()); assertTrue(lockFile.exists()); - + // try to open a second writer try { lfw2 = new LockableFileWriter(file); fail("Somehow able to open a locked file. "); } catch(final IOException ioe) { final String msg = ioe.getMessage(); - assertTrue( "Exception message does not start correctly. ", + assertTrue( "Exception message does not start correctly. ", msg.startsWith("Can't write file, lock ") ); assertTrue(file.exists()); assertTrue(lockFile.exists()); } - + // try to open a third writer try { lfw3 = new LockableFileWriter(file); fail("Somehow able to open a locked file. "); } catch(final IOException ioe) { final String msg = ioe.getMessage(); - assertTrue( "Exception message does not start correctly. ", + assertTrue( "Exception message does not start correctly. ", msg.startsWith("Can't write file, lock ") ); assertTrue(file.exists()); assertTrue(lockFile.exists()); } - + } finally { IOUtils.closeQuietly(lfw1); IOUtils.closeQuietly(lfw2); @@ -112,19 +112,19 @@ public class LockableFileWriterTest exte lfw1 = new LockableFileWriter(file, "UTF-8" ,true, altLockDir.getAbsolutePath()); assertTrue(file.exists()); assertTrue(altLockFile.exists()); - + // try to open a second writer try { lfw2 = new LockableFileWriter(file, Charsets.UTF_8, true, altLockDir.getAbsolutePath()); fail("Somehow able to open a locked file. "); } catch(final IOException ioe) { final String msg = ioe.getMessage(); - assertTrue( "Exception message does not start correctly. ", + assertTrue( "Exception message does not start correctly. ", msg.startsWith("Can't write file, lock ") ); assertTrue(file.exists()); assertTrue(altLockFile.exists()); } - + } finally { IOUtils.closeQuietly(lfw1); IOUtils.closeQuietly(lfw2); @@ -146,7 +146,7 @@ public class LockableFileWriterTest exte } assertTrue(file.exists()); assertFalse(lockFile.exists()); - + // open a second valid writer on the same file LockableFileWriter lfw2 = null; try { Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/ProxyWriterTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -19,7 +19,7 @@ package org.apache.commons.io.output; import junit.framework.TestCase; /** - * Test {@link ProxyWriter}. + * Test {@link ProxyWriter}. * * @version $Id$ */ @@ -39,7 +39,7 @@ public class ProxyWriterTest extends Tes fail("Appending CharSequence threw " + e); } assertEquals("ABC", writer.toString()); - proxy.close(); + proxy.close(); } /** Test Writing a String */ @@ -93,7 +93,7 @@ public class ProxyWriterTest extends Tes assertEquals("BC", writer.toString()); proxy.close(); } - + /** Test writing Null String */ public void testNullString() throws Exception { Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/WriterOutputStreamTest.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/WriterOutputStreamTest.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/WriterOutputStreamTest.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/output/WriterOutputStreamTest.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -25,7 +25,7 @@ import junit.framework.TestCase; public class WriterOutputStreamTest extends TestCase { private static final String TEST_STRING = "\u00e0 peine arriv\u00e9s nous entr\u00e2mes dans sa chambre"; private static final String LARGE_TEST_STRING; - + static { final StringBuilder buffer = new StringBuilder(); for (int i=0; i<100; i++) { @@ -33,9 +33,9 @@ public class WriterOutputStreamTest exte } LARGE_TEST_STRING = buffer.toString(); } - + private final Random random = new Random(); - + private void testWithSingleByteWrite(final String testString, final String charsetName) throws IOException { final byte[] bytes = testString.getBytes(charsetName); final StringWriter writer = new StringWriter(); @@ -46,7 +46,7 @@ public class WriterOutputStreamTest exte out.close(); assertEquals(testString, writer.toString()); } - + private void testWithBufferedWrite(final String testString, final String charsetName) throws IOException { final byte[] expected = testString.getBytes(charsetName); final StringWriter writer = new StringWriter(); @@ -60,23 +60,23 @@ public class WriterOutputStreamTest exte out.close(); assertEquals(testString, writer.toString()); } - + public void testUTF8WithSingleByteWrite() throws IOException { testWithSingleByteWrite(TEST_STRING, "UTF-8"); } - + public void testLargeUTF8WithSingleByteWrite() throws IOException { testWithSingleByteWrite(LARGE_TEST_STRING, "UTF-8"); } - + public void testUTF8WithBufferedWrite() throws IOException { testWithBufferedWrite(TEST_STRING, "UTF-8"); } - + public void testLargeUTF8WithBufferedWrite() throws IOException { testWithBufferedWrite(LARGE_TEST_STRING, "UTF-8"); } - + public void testUTF16WithSingleByteWrite() throws IOException { testWithSingleByteWrite(TEST_STRING, "UTF-16"); } @@ -101,7 +101,7 @@ public class WriterOutputStreamTest exte testWithBufferedWrite(TEST_STRING, "UTF-16LE"); } - + public void testFlush() throws IOException { final StringWriter writer = new StringWriter(); final WriterOutputStream out = new WriterOutputStream(writer, "us-ascii", 1024, false); @@ -111,7 +111,7 @@ public class WriterOutputStreamTest exte assertEquals("abc", writer.toString()); out.close(); } - + public void testWriteImmediately() throws IOException { final StringWriter writer = new StringWriter(); final WriterOutputStream out = new WriterOutputStream(writer, "us-ascii", 1024, true); Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/testtools/FileBasedTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/testtools/FileBasedTestCase.java?rev=1471765&r1=1471764&r2=1471765&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/testtools/FileBasedTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/testtools/FileBasedTestCase.java Wed Apr 24 23:20:29 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You 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. @@ -45,7 +45,7 @@ public abstract class FileBasedTestCase public FileBasedTestCase(final String name) { super(name); } - + public static File getTestDirectory() { if (testDir == null) { testDir = new File("test/io/").getAbsoluteFile(); @@ -53,11 +53,11 @@ public abstract class FileBasedTestCase testDir.mkdirs(); return testDir; } - + protected void createFile(final File file, final long size) throws IOException { if (!file.getParentFile().exists()) { - throw new IOException("Cannot create file " + file + throw new IOException("Cannot create file " + file + " as the parent directory does not exist"); } final BufferedOutputStream output = @@ -68,7 +68,7 @@ public abstract class FileBasedTestCase IOUtils.closeQuietly(output); } } - + protected byte[] generateTestData(final long size) { try { final ByteArrayOutputStream baout = new ByteArrayOutputStream(); @@ -78,8 +78,8 @@ public abstract class FileBasedTestCase throw new RuntimeException("This should never happen: " + ioe.getMessage()); } } - - protected void generateTestData(final OutputStream out, final long size) + + protected void generateTestData(final OutputStream out, final long size) throws IOException { for (int i = 0; i < size; i++) { //output.write((byte)'X'); @@ -225,6 +225,6 @@ public abstract class FileBasedTestCase assertTrue("Couldn't delete file: " + file, file.delete()); } } - + }
