@Test public void createFolderInDriveTest() throws IOException { File file = driveHelper.createNewFile("filename", DriveHelper.FOLDER_MIME_TYPE, "parentId"); doReturn("new_folder_id").when(mockedDriveService).createFile(file, "id"); String folderId = driveHelper.createFolderInDrive("filename", "parentId"); assertEquals("new_folder_id", folderId); Permission permission = new Permission() .setType("anyone") .setRole("reader"); verify(mockedDriveService, times(1)).setPermission("new_folder_id", "id", permission); }
public String createFolderInDrive(@NonNull String folderName, @Nullable String parentId) throws IOException { com.google.api.services.drive.model.File fileMetadata; fileMetadata = createNewFile(folderName, FOLDER_MIME_TYPE, parentId); String newFolderId = driveService.createFile(fileMetadata, "id"); setSharingPermissions(newFolderId); return newFolderId; }
DriveHelper { public String createFolderInDrive(@NonNull String folderName, @Nullable String parentId) throws IOException { com.google.api.services.drive.model.File fileMetadata; fileMetadata = createNewFile(folderName, FOLDER_MIME_TYPE, parentId); String newFolderId = driveService.createFile(fileMetadata, "id"); setSharingPermissions(newFolderId); return newFolderId; } }
DriveHelper { public String createFolderInDrive(@NonNull String folderName, @Nullable String parentId) throws IOException { com.google.api.services.drive.model.File fileMetadata; fileMetadata = createNewFile(folderName, FOLDER_MIME_TYPE, parentId); String newFolderId = driveService.createFile(fileMetadata, "id"); setSharingPermissions(newFolderId); return newFolderId; } DriveHelper(@NonNull GoogleAccountCredential credential,
                @NonNull HttpTransport transport,
                @NonNull JsonFactory jsonFactory);   DriveHelper(DriveService driveService); }
DriveHelper { public String createFolderInDrive(@NonNull String folderName, @Nullable String parentId) throws IOException { com.google.api.services.drive.model.File fileMetadata; fileMetadata = createNewFile(folderName, FOLDER_MIME_TYPE, parentId); String newFolderId = driveService.createFile(fileMetadata, "id"); setSharingPermissions(newFolderId); return newFolderId; } DriveHelper(@NonNull GoogleAccountCredential credential,
                @NonNull HttpTransport transport,
                @NonNull JsonFactory jsonFactory);   DriveHelper(DriveService driveService); String getRootFolderId(); @Nullable Drive.Files.List buildRequest(String query, String fields); void downloadFile(@NonNull String fileId, @NonNull File file); String createOrGetIDOfSubmissionsFolder(); @Nullable String getIDOfFolderWithName(@NonNull String name, @Nullable String inFolder, boolean shouldCreateIfNotFound); String uploadFileToDrive(String mediaName, String destinationFolderID, File toUpload); String createFolderInDrive(@NonNull String folderName,
                                      @Nullable String parentId); com.google.api.services.drive.model.File createNewFile(@NonNull String name,
                                                                  @Nullable String mimeType,
                                                                  @Nullable String parentId); List<com.google.api.services.drive.model.File> getFilesFromDrive(
            @Nullable String folderName,
            @Nullable String parentId); @Nullable String generateSearchQuery(@Nullable String folderName,
                                      @Nullable String parentId,
                                      @Nullable String mimeType); void fetchFilesForCurrentPage(Drive.Files.List request, List<com.google.api.services.drive.model.File> files); }
DriveHelper { public String createFolderInDrive(@NonNull String folderName, @Nullable String parentId) throws IOException { com.google.api.services.drive.model.File fileMetadata; fileMetadata = createNewFile(folderName, FOLDER_MIME_TYPE, parentId); String newFolderId = driveService.createFile(fileMetadata, "id"); setSharingPermissions(newFolderId); return newFolderId; } DriveHelper(@NonNull GoogleAccountCredential credential,
                @NonNull HttpTransport transport,
                @NonNull JsonFactory jsonFactory);   DriveHelper(DriveService driveService); String getRootFolderId(); @Nullable Drive.Files.List buildRequest(String query, String fields); void downloadFile(@NonNull String fileId, @NonNull File file); String createOrGetIDOfSubmissionsFolder(); @Nullable String getIDOfFolderWithName(@NonNull String name, @Nullable String inFolder, boolean shouldCreateIfNotFound); String uploadFileToDrive(String mediaName, String destinationFolderID, File toUpload); String createFolderInDrive(@NonNull String folderName,
                                      @Nullable String parentId); com.google.api.services.drive.model.File createNewFile(@NonNull String name,
                                                                  @Nullable String mimeType,
                                                                  @Nullable String parentId); List<com.google.api.services.drive.model.File> getFilesFromDrive(
            @Nullable String folderName,
            @Nullable String parentId); @Nullable String generateSearchQuery(@Nullable String folderName,
                                      @Nullable String parentId,
                                      @Nullable String mimeType); void fetchFilesForCurrentPage(Drive.Files.List request, List<com.google.api.services.drive.model.File> files); static final String ODK_GOOGLE_DRIVE_ROOT_FOLDER_NAME; static final String ODK_GOOGLE_DRIVE_SUBMISSION_FOLDER_NAME; static final String FOLDER_MIME_TYPE; }