public static boolean checkFile(String trackName,boolean shouldExist,Drive drive) throws IOException {
  long startTime=System.currentTimeMillis();
  while (System.currentTimeMillis() - startTime < MAX_TIME_TO_WAIT_SYNC) {
    boolean exist=getFile(trackName,drive) != null;
    if (exist == shouldExist) {
      return true;
    }
  }
  Assert.fail();
  return false;
}

public static boolean checkFile ( String trackName , boolean shouldExist , Drive drive ) throws IOException { long startTime = System . currentTimeMillis ( ) ; while ( System . currentTimeMillis ( ) - startTime < MAX_TIME_TO_WAIT_SYNC ) { boolean exist = getFile ( trackName , drive ) != null ; if ( exist == shouldExist ) { return true ; } } Assert . fail ( ) ; return false ; }
checks one file on google drive
