Skip to content

Commit b6f7a6a

Browse files
committed
Fix formatting in copyLarge methods.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1415243 13f79535-47bb-0310-9956-ffa450edef68
1 parent e396937 commit b6f7a6a

1 file changed

Lines changed: 84 additions & 94 deletions

File tree

src/test/java/org/apache/commons/io/IOUtilsTestCase.java

Lines changed: 84 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -890,22 +890,21 @@ public void testNoSkip() throws IOException {
890890
ByteArrayOutputStream os = null;
891891
try {
892892
// Create streams
893-
is = new ByteArrayInputStream( iarr);
893+
is = new ByteArrayInputStream(iarr);
894894
os = new ByteArrayOutputStream();
895895

896-
// Test our copy method
897-
assertEquals(100, IOUtils.copyLarge( is, os, 0, 100));
896+
// Test our copy method
897+
assertEquals(100, IOUtils.copyLarge(is, os, 0, 100));
898898
byte[] oarr = os.toByteArray();
899-
899+
900900
// check that output length is correct
901-
assertEquals( 100, oarr.length );
901+
assertEquals(100, oarr.length);
902902
// check that output data corresponds to input data
903-
assertEquals( 1, oarr[1] );
904-
assertEquals( 79, oarr[79] );
905-
assertEquals( -1, oarr[80] );
906-
907-
}
908-
finally {
903+
assertEquals(1, oarr[1]);
904+
assertEquals(79, oarr[79]);
905+
assertEquals(-1, oarr[80]);
906+
907+
} finally {
909908
IOUtils.closeQuietly(is);
910909
IOUtils.closeQuietly(os);
911910
}
@@ -916,22 +915,21 @@ public void testSkip() throws IOException {
916915
ByteArrayOutputStream os = null;
917916
try {
918917
// Create streams
919-
is = new ByteArrayInputStream( iarr);
918+
is = new ByteArrayInputStream(iarr);
920919
os = new ByteArrayOutputStream();
921920

922-
// Test our copy method
923-
assertEquals(100, IOUtils.copyLarge( is, os, 10, 100));
921+
// Test our copy method
922+
assertEquals(100, IOUtils.copyLarge(is, os, 10, 100));
924923
byte[] oarr = os.toByteArray();
925-
924+
926925
// check that output length is correct
927-
assertEquals( 100, oarr.length );
926+
assertEquals(100, oarr.length);
928927
// check that output data corresponds to input data
929-
assertEquals( 11, oarr[1] );
930-
assertEquals( 79, oarr[69] );
931-
assertEquals( -1, oarr[70] );
932-
933-
}
934-
finally {
928+
assertEquals(11, oarr[1]);
929+
assertEquals(79, oarr[69]);
930+
assertEquals(-1, oarr[70]);
931+
932+
} finally {
935933
IOUtils.closeQuietly(is);
936934
IOUtils.closeQuietly(os);
937935
}
@@ -962,22 +960,21 @@ public void testFullLength() throws IOException {
962960
ByteArrayOutputStream os = null;
963961
try {
964962
// Create streams
965-
is = new ByteArrayInputStream( iarr);
963+
is = new ByteArrayInputStream(iarr);
966964
os = new ByteArrayOutputStream();
967965

968-
// Test our copy method
969-
assertEquals(200, IOUtils.copyLarge( is, os, 0, -1));
966+
// Test our copy method
967+
assertEquals(200, IOUtils.copyLarge(is, os, 0, -1));
970968
byte[] oarr = os.toByteArray();
971-
969+
972970
// check that output length is correct
973-
assertEquals( 200, oarr.length );
971+
assertEquals(200, oarr.length);
974972
// check that output data corresponds to input data
975-
assertEquals( 1, oarr[1] );
976-
assertEquals( 79, oarr[79] );
977-
assertEquals( -1, oarr[80] );
978-
979-
}
980-
finally {
973+
assertEquals(1, oarr[1]);
974+
assertEquals(79, oarr[79]);
975+
assertEquals(-1, oarr[80]);
976+
977+
} finally {
981978
IOUtils.closeQuietly(is);
982979
IOUtils.closeQuietly(os);
983980
}
@@ -988,23 +985,22 @@ public void testExtraLength() throws IOException {
988985
ByteArrayOutputStream os = null;
989986
try {
990987
// Create streams
991-
is = new ByteArrayInputStream( iarr);
988+
is = new ByteArrayInputStream(iarr);
992989
os = new ByteArrayOutputStream();
993990

994991
// Test our copy method
995992
// for extra length, it reads till EOF
996-
assertEquals(200, IOUtils.copyLarge( is, os, 0, 2000));
993+
assertEquals(200, IOUtils.copyLarge(is, os, 0, 2000));
997994
byte[] oarr = os.toByteArray();
998-
995+
999996
// check that output length is correct
1000-
assertEquals( 200, oarr.length );
997+
assertEquals(200, oarr.length);
1001998
// check that output data corresponds to input data
1002-
assertEquals( 1, oarr[1] );
1003-
assertEquals( 79, oarr[79] );
1004-
assertEquals( -1, oarr[80] );
1005-
1006-
}
1007-
finally {
999+
assertEquals(1, oarr[1]);
1000+
assertEquals(79, oarr[79]);
1001+
assertEquals(-1, oarr[80]);
1002+
1003+
} finally {
10081004
IOUtils.closeQuietly(is);
10091005
IOUtils.closeQuietly(os);
10101006
}
@@ -1017,22 +1013,21 @@ public void testCharNoSkip() throws IOException {
10171013
CharArrayWriter os = null;
10181014
try {
10191015
// Create streams
1020-
is = new CharArrayReader( carr);
1016+
is = new CharArrayReader(carr);
10211017
os = new CharArrayWriter();
10221018

1023-
// Test our copy method
1024-
assertEquals(100, IOUtils.copyLarge( is, os, 0, 100));
1019+
// Test our copy method
1020+
assertEquals(100, IOUtils.copyLarge(is, os, 0, 100));
10251021
char[] oarr = os.toCharArray();
1026-
1022+
10271023
// check that output length is correct
1028-
assertEquals( 100, oarr.length );
1024+
assertEquals(100, oarr.length);
10291025
// check that output data corresponds to input data
1030-
assertEquals( 1, oarr[1] );
1031-
assertEquals( 79, oarr[79] );
1032-
assertEquals((char) -1, oarr[80] );
1033-
1034-
}
1035-
finally {
1026+
assertEquals(1, oarr[1]);
1027+
assertEquals(79, oarr[79]);
1028+
assertEquals((char) -1, oarr[80]);
1029+
1030+
} finally {
10361031
IOUtils.closeQuietly(is);
10371032
IOUtils.closeQuietly(os);
10381033
}
@@ -1043,22 +1038,21 @@ public void testCharSkip() throws IOException {
10431038
CharArrayWriter os = null;
10441039
try {
10451040
// Create streams
1046-
is = new CharArrayReader( carr);
1041+
is = new CharArrayReader(carr);
10471042
os = new CharArrayWriter();
10481043

1049-
// Test our copy method
1050-
assertEquals(100, IOUtils.copyLarge( is, os, 10, 100));
1044+
// Test our copy method
1045+
assertEquals(100, IOUtils.copyLarge(is, os, 10, 100));
10511046
char[] oarr = os.toCharArray();
1052-
1047+
10531048
// check that output length is correct
1054-
assertEquals( 100, oarr.length );
1049+
assertEquals(100, oarr.length);
10551050
// check that output data corresponds to input data
1056-
assertEquals( 11, oarr[1] );
1057-
assertEquals( 79, oarr[69] );
1058-
assertEquals((char) -1, oarr[70] );
1059-
1060-
}
1061-
finally {
1051+
assertEquals(11, oarr[1]);
1052+
assertEquals(79, oarr[69]);
1053+
assertEquals((char) -1, oarr[70]);
1054+
1055+
} finally {
10621056
IOUtils.closeQuietly(is);
10631057
IOUtils.closeQuietly(os);
10641058
}
@@ -1069,16 +1063,14 @@ public void testCharSkipInvalid() throws IOException {
10691063
CharArrayWriter os = null;
10701064
try {
10711065
// Create streams
1072-
is = new CharArrayReader( carr);
1066+
is = new CharArrayReader(carr);
10731067
os = new CharArrayWriter();
10741068

1075-
// Test our copy method
1076-
IOUtils.copyLarge( is, os, 1000, 100);
1077-
fail( "Should have thrown EOFException");
1078-
}
1079-
catch( EOFException eofe){
1080-
}
1081-
finally {
1069+
// Test our copy method
1070+
IOUtils.copyLarge(is, os, 1000, 100);
1071+
fail("Should have thrown EOFException");
1072+
} catch (EOFException eofe) {
1073+
} finally {
10821074
IOUtils.closeQuietly(is);
10831075
IOUtils.closeQuietly(os);
10841076
}
@@ -1089,22 +1081,21 @@ public void testCharFullLength() throws IOException {
10891081
CharArrayWriter os = null;
10901082
try {
10911083
// Create streams
1092-
is = new CharArrayReader( carr);
1084+
is = new CharArrayReader(carr);
10931085
os = new CharArrayWriter();
10941086

1095-
// Test our copy method
1096-
assertEquals(200, IOUtils.copyLarge( is, os, 0, -1));
1087+
// Test our copy method
1088+
assertEquals(200, IOUtils.copyLarge(is, os, 0, -1));
10971089
char[] oarr = os.toCharArray();
1098-
1090+
10991091
// check that output length is correct
1100-
assertEquals( 200, oarr.length );
1092+
assertEquals(200, oarr.length);
11011093
// check that output data corresponds to input data
1102-
assertEquals( 1, oarr[1] );
1103-
assertEquals( 79, oarr[79] );
1104-
assertEquals((char) -1, oarr[80] );
1105-
1106-
}
1107-
finally {
1094+
assertEquals(1, oarr[1]);
1095+
assertEquals(79, oarr[79]);
1096+
assertEquals((char) -1, oarr[80]);
1097+
1098+
} finally {
11081099
IOUtils.closeQuietly(is);
11091100
IOUtils.closeQuietly(os);
11101101
}
@@ -1115,23 +1106,22 @@ public void testCharExtraLength() throws IOException {
11151106
CharArrayWriter os = null;
11161107
try {
11171108
// Create streams
1118-
is = new CharArrayReader( carr);
1109+
is = new CharArrayReader(carr);
11191110
os = new CharArrayWriter();
11201111

11211112
// Test our copy method
11221113
// for extra length, it reads till EOF
1123-
assertEquals(200, IOUtils.copyLarge( is, os, 0, 2000));
1114+
assertEquals(200, IOUtils.copyLarge(is, os, 0, 2000));
11241115
char[] oarr = os.toCharArray();
1125-
1116+
11261117
// check that output length is correct
1127-
assertEquals( 200, oarr.length );
1118+
assertEquals(200, oarr.length);
11281119
// check that output data corresponds to input data
1129-
assertEquals( 1, oarr[1] );
1130-
assertEquals( 79, oarr[79] );
1131-
assertEquals((char) -1, oarr[80] );
1132-
1133-
}
1134-
finally {
1120+
assertEquals(1, oarr[1]);
1121+
assertEquals(79, oarr[79]);
1122+
assertEquals((char) -1, oarr[80]);
1123+
1124+
} finally {
11351125
IOUtils.closeQuietly(is);
11361126
IOUtils.closeQuietly(os);
11371127
}

0 commit comments

Comments
 (0)