test_class.declarator: sheetsService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SheetsHelper.SheetsService sheetsService;
test_class.type: SheetsHelper.SheetsService
test_class.var_name: sheetsService
test_class.declarator: sheetsHelper
test_class.modifier: private
test_class.original_string: private SheetsHelper sheetsHelper;
test_class.type: SheetsHelper
test_class.var_name: sheetsHelper
test_class.file: collect_app/src/test/java/org/odk/collect/android/utilities/gdrive/SheetsHelperTest.java
test_class.identifier: SheetsHelperTest
test_case.body: @Test
      public void getSpreadsheetTest() throws IOException {
          Spreadsheet mockedSpreadsheet = mock(Spreadsheet.class);
          SpreadsheetProperties mockedProperties = mock(SpreadsheetProperties.class);
  
          doReturn("sheet_title").when(mockedProperties).getTitle();
          doReturn(mockedProperties).when(mockedSpreadsheet).getProperties();
          doReturn(mockedSpreadsheet).when(sheetsService).getSpreadsheet("spreadsheet_id");
  
          Spreadsheet spreadsheet = sheetsHelper.getSpreadsheet("spreadsheet_id");
  
          assertEquals(mockedSpreadsheet, spreadsheet);
          assertBatchUpdateCalled(1);
      }
test_case.class_method_signature: SheetsHelperTest.getSpreadsheetTest()
test_case.full_signature: @Test public void getSpreadsheetTest()
test_case.identifier: getSpreadsheetTest
test_case.invocations: mock mock getTitle when doReturn getProperties when doReturn getSpreadsheet when doReturn getSpreadsheet assertEquals assertBatchUpdateCalled
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getSpreadsheetTest()
focal_class.declarator: sheetsService
focal_class.modifier: private final
focal_class.original_string: private final SheetsService sheetsService;
focal_class.type: SheetsService
focal_class.var_name: sheetsService
focal_class.file: collect_app/src/main/java/org/odk/collect/android/utilities/gdrive/SheetsHelper.java
focal_class.identifier: SheetsHelper
focal_class.class_method_signature: SheetsHelper.SheetsHelper(GoogleAccountCredential credential, HttpTransport transport, JsonFactory jsonFactory)
focal_class.full_signature:   SheetsHelper(GoogleAccountCredential credential, HttpTransport transport, JsonFactory jsonFactory)
focal_class.identifier: SheetsHelper
focal_class.parameters: (GoogleAccountCredential credential, HttpTransport transport, JsonFactory jsonFactory)
focal_class.signature:  SheetsHelper(GoogleAccountCredential credential, HttpTransport transport, JsonFactory jsonFactory)
focal_class.class_method_signature: SheetsHelper.SheetsHelper(@NonNull SheetsService sheetsService)
focal_class.full_signature:   SheetsHelper(@NonNull SheetsService sheetsService)
focal_class.identifier: SheetsHelper
focal_class.parameters: (@NonNull SheetsService sheetsService)
focal_class.signature:  SheetsHelper(@NonNull SheetsService sheetsService)
focal_class.class_method_signature: SheetsHelper.resizeSpreadSheet(String spreadsheetId, int sheetId, int columnSize)
focal_class.full_signature: public void resizeSpreadSheet(String spreadsheetId, int sheetId, int columnSize)
focal_class.identifier: resizeSpreadSheet
focal_class.modifiers: public
focal_class.parameters: (String spreadsheetId, int sheetId, int columnSize)
focal_class.return: void
focal_class.signature: void resizeSpreadSheet(String spreadsheetId, int sheetId, int columnSize)
focal_class.class_method_signature: SheetsHelper.insertRow(String spreadsheetId, String sheetName, ValueRange row)
focal_class.full_signature: public void insertRow(String spreadsheetId, String sheetName, ValueRange row)
focal_class.identifier: insertRow
focal_class.modifiers: public
focal_class.parameters: (String spreadsheetId, String sheetName, ValueRange row)
focal_class.return: void
focal_class.signature: void insertRow(String spreadsheetId, String sheetName, ValueRange row)
focal_class.class_method_signature: SheetsHelper.updateRow(String spreadsheetId, String sheetName, ValueRange row)
focal_class.full_signature: public void updateRow(String spreadsheetId, String sheetName, ValueRange row)
focal_class.identifier: updateRow
focal_class.modifiers: public
focal_class.parameters: (String spreadsheetId, String sheetName, ValueRange row)
focal_class.return: void
focal_class.signature: void updateRow(String spreadsheetId, String sheetName, ValueRange row)
focal_class.class_method_signature: SheetsHelper.addSheet(String spreadsheetId, String sheetName)
focal_class.full_signature: public void addSheet(String spreadsheetId, String sheetName)
focal_class.identifier: addSheet
focal_class.modifiers: public
focal_class.parameters: (String spreadsheetId, String sheetName)
focal_class.return: void
focal_class.signature: void addSheet(String spreadsheetId, String sheetName)
focal_class.class_method_signature: SheetsHelper.getSheetCells(String spreadsheetId, String sheetName)
focal_class.full_signature: public List<List<Object>> getSheetCells(String spreadsheetId, String sheetName)
focal_class.identifier: getSheetCells
focal_class.modifiers: public
focal_class.parameters: (String spreadsheetId, String sheetName)
focal_class.return: List<List<Object>>
focal_class.signature: List<List<Object>> getSheetCells(String spreadsheetId, String sheetName)
focal_class.class_method_signature: SheetsHelper.getSpreadsheet(String spreadsheetId)
focal_class.full_signature: public Spreadsheet getSpreadsheet(String spreadsheetId)
focal_class.identifier: getSpreadsheet
focal_class.modifiers: public
focal_class.parameters: (String spreadsheetId)
focal_class.return: Spreadsheet
focal_class.signature: Spreadsheet getSpreadsheet(String spreadsheetId)
focal_method.body: public Spreadsheet getSpreadsheet(String spreadsheetId) throws IOException {
  
          /*
           * Read permission check
           *
           * To check read permissions, we are trying to fetch the complete spreadsheet using the
           * given spreadsheet id
           */
  
          // fetching the google spreadsheet
          Spreadsheet spreadsheet = sheetsService.getSpreadsheet(spreadsheetId);
  
          String spreadsheetFileName = spreadsheet.getProperties().getTitle();
  
          /*
           * Write permission check
           *
           * To check write permissions, we are trying to overwrite the name of the spreadsheet with
           * the same name
           *
           * Todo 22/3/17 Find a better way to check the write permissions
           */
  
          // creating a request to update name of spreadsheet
          SpreadsheetProperties sheetProperties = new SpreadsheetProperties()
                  .setTitle(spreadsheetFileName);
  
          List<Request> requests = new ArrayList<>();
          requests.add(
                  new Request().setUpdateSpreadsheetProperties(
                          new UpdateSpreadsheetPropertiesRequest()
                                  .setProperties(sheetProperties)
                                  .setFields("title")));
  
          // updating the spreadsheet with the given id
          sheetsService.batchUpdate(spreadsheetId, requests);
          return spreadsheet;
      }
focal_method.class_method_signature: SheetsHelper.getSpreadsheet(String spreadsheetId)
focal_method.full_signature: public Spreadsheet getSpreadsheet(String spreadsheetId)
focal_method.identifier: getSpreadsheet
focal_method.invocations: getSpreadsheet getTitle getProperties setTitle add setUpdateSpreadsheetProperties setFields setProperties batchUpdate
focal_method.modifiers: public
focal_method.parameters: (String spreadsheetId)
focal_method.return: Spreadsheet
focal_method.signature: Spreadsheet getSpreadsheet(String spreadsheetId)