1717package org .apache .commons .io .output ;
1818
1919import static org .junit .jupiter .api .Assertions .assertEquals ;
20+ import static org .junit .jupiter .api .Assertions .assertTrue ;
2021import static org .junit .jupiter .api .Assertions .fail ;
2122import static org .mockito .Mockito .mock ;
2223import static org .mockito .Mockito .verify ;
@@ -40,6 +41,7 @@ public class ProxyCollectionWriterTest {
4041 public void testArrayIOExceptionOnAppendChar1 () throws IOException {
4142 final Writer badW = new BrokenWriter ();
4243 final StringWriter goodW = mock (StringWriter .class );
44+ @ SuppressWarnings ("resource" ) // not necessary to close this
4345 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
4446 final char data = 'A' ;
4547 try {
@@ -56,6 +58,7 @@ public void testArrayIOExceptionOnAppendChar1() throws IOException {
5658 public void testArrayIOExceptionOnAppendChar2 () throws IOException {
5759 final Writer badW = new BrokenWriter ();
5860 final StringWriter goodW = mock (StringWriter .class );
61+ @ SuppressWarnings ("resource" ) // not necessary to close this
5962 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
6063 final char data = 'A' ;
6164 try {
@@ -72,6 +75,7 @@ public void testArrayIOExceptionOnAppendChar2() throws IOException {
7275 public void testArrayIOExceptionOnAppendCharSequence1 () throws IOException {
7376 final Writer badW = new BrokenWriter ();
7477 final StringWriter goodW = mock (StringWriter .class );
78+ @ SuppressWarnings ("resource" ) // not necessary to close this
7579 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
7680 final CharSequence data = "A" ;
7781 try {
@@ -88,6 +92,7 @@ public void testArrayIOExceptionOnAppendCharSequence1() throws IOException {
8892 public void testArrayIOExceptionOnAppendCharSequence2 () throws IOException {
8993 final Writer badW = new BrokenWriter ();
9094 final StringWriter goodW = mock (StringWriter .class );
95+ @ SuppressWarnings ("resource" ) // not necessary to close this
9196 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
9297 final CharSequence data = "A" ;
9398 try {
@@ -104,6 +109,7 @@ public void testArrayIOExceptionOnAppendCharSequence2() throws IOException {
104109 public void testArrayIOExceptionOnAppendCharSequenceIntInt1 () throws IOException {
105110 final Writer badW = new BrokenWriter ();
106111 final StringWriter goodW = mock (StringWriter .class );
112+ @ SuppressWarnings ("resource" ) // not necessary to close this
107113 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
108114 final CharSequence data = "A" ;
109115 try {
@@ -120,6 +126,7 @@ public void testArrayIOExceptionOnAppendCharSequenceIntInt1() throws IOException
120126 public void testArrayIOExceptionOnAppendCharSequenceIntInt2 () throws IOException {
121127 final Writer badW = new BrokenWriter ();
122128 final StringWriter goodW = mock (StringWriter .class );
129+ @ SuppressWarnings ("resource" ) // not necessary to close this
123130 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
124131 final CharSequence data = "A" ;
125132 try {
@@ -136,6 +143,7 @@ public void testArrayIOExceptionOnAppendCharSequenceIntInt2() throws IOException
136143 public void testArrayIOExceptionOnClose1 () throws IOException {
137144 final Writer badW = new BrokenWriter ();
138145 final StringWriter goodW = mock (StringWriter .class );
146+ @ SuppressWarnings ("resource" ) // not necessary to close this
139147 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
140148 try {
141149 tw .close ();
@@ -151,6 +159,7 @@ public void testArrayIOExceptionOnClose1() throws IOException {
151159 public void testArrayIOExceptionOnClose2 () throws IOException {
152160 final Writer badW = new BrokenWriter ();
153161 final StringWriter goodW = mock (StringWriter .class );
162+ @ SuppressWarnings ("resource" ) // not necessary to close this
154163 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
155164 try {
156165 tw .close ();
@@ -166,6 +175,7 @@ public void testArrayIOExceptionOnClose2() throws IOException {
166175 public void testArrayIOExceptionOnFlush1 () throws IOException {
167176 final Writer badW = new BrokenWriter ();
168177 final StringWriter goodW = mock (StringWriter .class );
178+ @ SuppressWarnings ("resource" ) // not necessary to close this
169179 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
170180 try {
171181 tw .flush ();
@@ -181,6 +191,7 @@ public void testArrayIOExceptionOnFlush1() throws IOException {
181191 public void testArrayIOExceptionOnFlush2 () throws IOException {
182192 final Writer badW = new BrokenWriter ();
183193 final StringWriter goodW = mock (StringWriter .class );
194+ @ SuppressWarnings ("resource" ) // not necessary to close this
184195 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
185196 try {
186197 tw .flush ();
@@ -196,6 +207,7 @@ public void testArrayIOExceptionOnFlush2() throws IOException {
196207 public void testArrayIOExceptionOnWriteCharArray1 () throws IOException {
197208 final Writer badW = new BrokenWriter ();
198209 final StringWriter goodW = mock (StringWriter .class );
210+ @ SuppressWarnings ("resource" ) // not necessary to close this
199211 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
200212 final char [] data = new char [] { 'a' };
201213 try {
@@ -212,6 +224,7 @@ public void testArrayIOExceptionOnWriteCharArray1() throws IOException {
212224 public void testArrayIOExceptionOnWriteCharArray2 () throws IOException {
213225 final Writer badW = new BrokenWriter ();
214226 final StringWriter goodW = mock (StringWriter .class );
227+ @ SuppressWarnings ("resource" ) // not necessary to close this
215228 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
216229 final char [] data = new char [] { 'a' };
217230 try {
@@ -228,6 +241,7 @@ public void testArrayIOExceptionOnWriteCharArray2() throws IOException {
228241 public void testArrayIOExceptionOnWriteCharArrayIntInt1 () throws IOException {
229242 final Writer badW = new BrokenWriter ();
230243 final StringWriter goodW = mock (StringWriter .class );
244+ @ SuppressWarnings ("resource" ) // not necessary to close this
231245 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
232246 final char [] data = new char [] { 'a' };
233247 try {
@@ -244,6 +258,7 @@ public void testArrayIOExceptionOnWriteCharArrayIntInt1() throws IOException {
244258 public void testArrayIOExceptionOnWriteCharArrayIntInt2 () throws IOException {
245259 final Writer badW = new BrokenWriter ();
246260 final StringWriter goodW = mock (StringWriter .class );
261+ @ SuppressWarnings ("resource" ) // not necessary to close this
247262 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
248263 final char [] data = new char [] { 'a' };
249264 try {
@@ -260,6 +275,7 @@ public void testArrayIOExceptionOnWriteCharArrayIntInt2() throws IOException {
260275 public void testArrayIOExceptionOnWriteInt1 () throws IOException {
261276 final Writer badW = new BrokenWriter ();
262277 final StringWriter goodW = mock (StringWriter .class );
278+ @ SuppressWarnings ("resource" ) // not necessary to close this
263279 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
264280 final int data = 32 ;
265281 try {
@@ -276,6 +292,7 @@ public void testArrayIOExceptionOnWriteInt1() throws IOException {
276292 public void testArrayIOExceptionOnWriteInt2 () throws IOException {
277293 final Writer badW = new BrokenWriter ();
278294 final StringWriter goodW = mock (StringWriter .class );
295+ @ SuppressWarnings ("resource" ) // not necessary to close this
279296 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
280297 try {
281298 tw .write (32 );
@@ -292,6 +309,7 @@ public void testArrayIOExceptionOnWriteInt2() throws IOException {
292309 public void testArrayIOExceptionOnWriteString1 () throws IOException {
293310 final Writer badW = new BrokenWriter ();
294311 final StringWriter goodW = mock (StringWriter .class );
312+ @ SuppressWarnings ("resource" ) // not necessary to close this
295313 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
296314 final String data = "A" ;
297315 try {
@@ -308,6 +326,7 @@ public void testArrayIOExceptionOnWriteString1() throws IOException {
308326 public void testArrayIOExceptionOnWriteString2 () throws IOException {
309327 final Writer badW = new BrokenWriter ();
310328 final StringWriter goodW = mock (StringWriter .class );
329+ @ SuppressWarnings ("resource" ) // not necessary to close this
311330 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
312331 final String data = "A" ;
313332 try {
@@ -325,6 +344,7 @@ public void testArrayIOExceptionOnWriteString2() throws IOException {
325344 public void testArrayIOExceptionOnWriteStringIntInt1 () throws IOException {
326345 final Writer badW = new BrokenWriter ();
327346 final StringWriter goodW = mock (StringWriter .class );
347+ @ SuppressWarnings ("resource" ) // not necessary to close this
328348 final ProxyCollectionWriter tw = new ProxyCollectionWriter (badW , goodW , null );
329349 final String data = "A" ;
330350 try {
@@ -341,6 +361,7 @@ public void testArrayIOExceptionOnWriteStringIntInt1() throws IOException {
341361 public void testArrayIOExceptionOnWriteStringIntInt2 () throws IOException {
342362 final Writer badW = new BrokenWriter ();
343363 final StringWriter goodW = mock (StringWriter .class );
364+ @ SuppressWarnings ("resource" ) // not necessary to close this
344365 final ProxyCollectionWriter tw = new ProxyCollectionWriter (goodW , badW , null );
345366 final String data = "A" ;
346367 try {
@@ -358,6 +379,7 @@ public void testArrayIOExceptionOnWriteStringIntInt2() throws IOException {
358379 public void testCollectionCloseBranchIOException () throws IOException {
359380 final Writer badW = new BrokenWriter ();
360381 final StringWriter goodW = mock (StringWriter .class );
382+ @ SuppressWarnings ("resource" ) // not necessary to close this
361383 final ProxyCollectionWriter tw = new ProxyCollectionWriter (Arrays .asList (goodW , badW , null ));
362384 try {
363385 tw .close ();
@@ -382,6 +404,7 @@ public void testConstructorsNull() throws IOException {
382404 teeWriter .append ('a' );
383405 teeWriter .flush ();
384406 }
407+ assertTrue (true , "Dummy to show test completed OK" );
385408 }
386409
387410 @ Test
0 commit comments