private static void setLength(FileSystem fileSystem, String file, long length) throws TestFailedException {
		FileHandle handle;
		try {
			handle = fileSystem.openFile(file, true, true);
		} catch (PathNotFoundException e) {
			throw new TestFailedException(e);
		} catch (AccessDeniedException e) {
			throw new TestFailedException("You have claimed that the file system is not read only", e);
		} catch (NotAFileException e) {
			throw new TestFailedException(file + " should be a file", e);
		}
		
		try {
			fileSystem.setLength(handle, length);
		} catch (DriveFullException e) {
			throw new TestFailedException(e);
		}
		try
		{
			fileSystem.close(handle);
		} catch (DriveFullException e) {
			throw new TestFailedException(e);
		}
	}