1616 */
1717package org .aarboard .nextcloud .api ;
1818
19+ import static org .junit .Assert .assertEquals ;
1920import static org .junit .Assert .assertFalse ;
2021import static org .junit .Assert .assertTrue ;
2122
2627import org .aarboard .nextcloud .api .webdav .ResourceProperties ;
2728import org .junit .Assert ;
2829import static org .junit .Assert .assertNotNull ;
30+ import static org .junit .Assert .fail ;
31+
2932import org .junit .FixMethodOrder ;
3033import org .junit .Test ;
3134import org .junit .runners .MethodSorters ;
@@ -257,11 +260,13 @@ public void t27_99_testFileProperties() {
257260 try
258261 {
259262 _nc .getProperties (TESTFILE2 +"-not-existing" , false );
260- assertFalse ("Resource should throw 404 error" , true );
263+ fail ("Resource should throw 404 error" );
261264 }
262265 catch (Exception ex )
263266 {
264- assertTrue ("com.github.sardine.impl.SardineException: status code: 404, reason phrase: Unexpected response (404 Not Found)" .equals (ex .getMessage ()));
267+ assertEquals (
268+ "com.github.sardine.impl.SardineException: status code: 404, reason phrase: Unexpected response (404 Not Found)" ,
269+ ex .getMessage ());
265270 }
266271 }
267272 }
@@ -280,7 +285,8 @@ public void t28_3_testDowloadFile() throws IOException {
280285 nCount ++;
281286 }
282287 is .close ();
283- assertTrue ("Downloaded content size does not match" , nCount == TEST3_FILE_CONTENT .length ());
288+ assertEquals ("Downloaded content size does not match" , nCount ,
289+ TEST3_FILE_CONTENT .length ());
284290 }
285291 }
286292
@@ -292,11 +298,12 @@ public void t29_3_testDowloadFile() throws IOException {
292298 File of = new File (System .getProperty ("java.io.tmpdir" )+File .separator +TESTFILE1 );
293299 if (_nc .downloadFile (TESTFILE1 , of .getParent ()))
294300 {
295- assertTrue ("Downloaded content size does not match" , of .length () == TEST1_FILE_CONTENT .length ());
301+ assertEquals ("Downloaded content size does not match" , of .length (),
302+ TEST1_FILE_CONTENT .length ());
296303 }
297304 else
298305 {
299- assertTrue ("Downloaded file failed" , false );
306+ fail ("Downloaded file failed" );
300307 }
301308 if (of .exists ())
302309 {
@@ -313,11 +320,11 @@ public void t29_3_testDowloadFile4() throws IOException {
313320 File of = new File (System .getProperty ("java.io.tmpdir" )+File .separator +TESTFILE4 );
314321 if (_nc .downloadFile (TESTFILE4 , of .getParent ()))
315322 {
316- assertTrue ("Downloaded content size does not match" , of .length () == 0 );
323+ assertEquals ("Downloaded content size does not match" , 0 , of .length ());
317324 }
318325 else
319326 {
320- assertTrue ("Downloaded file failed" , false );
327+ fail ("Downloaded file failed" );
321328 }
322329 if (of .exists ())
323330 {
@@ -335,11 +342,11 @@ public void t29_6_testDowloadFile6() throws IOException {
335342 if (_nc .downloadFile (TESTFILE6 , of .getParent ()))
336343 {
337344 File srcFile = new File ("src/test/resources/" +TESTFILE6 );
338- assertTrue ("Downloaded content size does not match" , of .length () == srcFile .length ());
345+ assertEquals ("Downloaded content size does not match" , of .length (), srcFile .length ());
339346 }
340347 else
341348 {
342- assertTrue ("Downloaded file failed" , false );
349+ fail ("Downloaded file failed" );
343350 }
344351 if (of .exists ())
345352 {
@@ -357,11 +364,11 @@ public void t29_6_testDowloadFile7() throws IOException {
357364 if (_nc .downloadFile (TESTFILE7 , of .getParent ()))
358365 {
359366 File srcFile = new File ("src/test/resources/" +TESTFILE7 );
360- assertTrue ("Downloaded content size does not match" , of .length () == srcFile .length ());
367+ assertEquals ("Downloaded content size does not match" , of .length (), srcFile .length ());
361368 }
362369 else
363370 {
364- assertTrue ("Downloaded file failed" , false );
371+ fail ("Downloaded file failed" );
365372 }
366373 if (of .exists ())
367374 {
0 commit comments