public void testGetRow() throws SmartsheetException, IOException {
   smartsheet
       .sheetResources()
       .rowResources()
       .getRow(sheet.getId(), newRows.get(0).getId(), null, null);
   row =
       smartsheet
           .sheetResources()
           .rowResources()
           .getRow(
               sheet.getId(),
               newRows.get(0).getId(),
               EnumSet.of(RowInclusion.COLUMNS, RowInclusion.COLUMN_TYPE),
               EnumSet.of(ObjectExclusion.NONEXISTENT_CELLS));
   assertNotNull(row);
 }
  public void testAddRows() throws SmartsheetException, IOException {
    // create sheet
    sheet = smartsheet.sheetResources().createSheet(createSheetObject());

    // get column
    PaginationParameters parameters =
        new PaginationParameters.PaginationParametersBuilder().setIncludeAll(true).build();
    PagedResult<Column> wrapper =
        smartsheet
            .sheetResources()
            .columnResources()
            .listColumns(sheet.getId(), EnumSet.allOf(ColumnInclusion.class), parameters);

    Column addedColumn1 = wrapper.getData().get(0);
    Column addedColumn2 = wrapper.getData().get(1);

    // Specify cell values for first row.
    List<Cell> cellsA =
        new Cell.AddRowCellsBuilder()
            .addCell(addedColumn1.getId(), true)
            .addCell(addedColumn2.getId(), "New status")
            .build();

    // Specify contents of first row.
    row = new Row.AddRowBuilder().setCells(cellsA).setToBottom(true).build();

    // Specify cell values for second row.
    List<Cell> cellsB =
        new Cell.AddRowCellsBuilder()
            .addCell(addedColumn1.getId(), true)
            .addCell(addedColumn2.getId(), "New status")
            .build();

    // Specify contents of first row.
    Row rowA = new Row.AddRowBuilder().setCells(cellsB).setToBottom(true).build();

    newRows =
        smartsheet.sheetResources().rowResources().addRows(sheet.getId(), Arrays.asList(row, rowA));

    List<Column> columns = wrapper.getData();
    addedColumn = columns.get(1);
  }
  @Test
  public void testUpdateRows() throws SmartsheetException, IOException {
    // create sheet
    Sheet sheet = smartsheet.sheetResources().createSheet(createSheetObject());
    PaginationParameters parameters =
        new PaginationParameters.PaginationParametersBuilder().setIncludeAll(true).build();
    PagedResult<Column> wrapper =
        smartsheet
            .sheetResources()
            .columnResources()
            .listColumns(sheet.getId(), EnumSet.allOf(ColumnInclusion.class), parameters);

    Column addedColumn1 = wrapper.getData().get(0);
    Column addedColumn2 = wrapper.getData().get(1);

    // Specify cell values for first row.
    List<Cell> cellsA =
        new Cell.AddRowCellsBuilder()
            .addCell(addedColumn1.getId(), true)
            .addCell(addedColumn2.getId(), "New status")
            .build();

    // Specify contents of first row.
    Row row = new Row.AddRowBuilder().setCells(cellsA).setToBottom(true).build();
    List<Row> newRows =
        smartsheet.sheetResources().rowResources().addRows(sheet.getId(), Arrays.asList(row));

    // Updated cells //correct
    List<Cell> cellsB =
        new Cell.UpdateRowCellsBuilder()
            .addCell(addedColumn1.getId(), true)
            .addCell(addedColumn2.getId(), "Updtaed status")
            .build();

    Row rowB = new Row.UpdateRowBuilder().setCells(cellsB).setRowId(newRows.get(0).getId()).build();

    List<Row> updatedRows =
        smartsheet.sheetResources().rowResources().updateRows(sheet.getId(), Arrays.asList(rowB));

    assertNotNull(updatedRows);
    deleteSheet(sheet.getId());
  }
  public void testDeleteRows() throws SmartsheetException, IOException {
    testAddRows();
    smartsheet
        .sheetResources()
        .rowResources()
        .deleteRows(sheet.getId(), new HashSet(Arrays.asList(newRows.get(0).getId())), true);

    // clean up
    deleteSheet(sheet.getId());
    deleteSheet(copyToSheet.getId());
  }
  public void testSendRows() throws SmartsheetException, IOException {
    // Specify individual recipient.
    RecipientEmail recipientEmail =
        new RecipientEmail.AddRecipientEmailBuilder().setEmail("*****@*****.**").build();

    List<Recipient> recipients = new ArrayList<Recipient>();
    recipients.add(recipientEmail);

    MultiRowEmail multiRowEmail =
        new MultiRowEmail.AddMultiRowEmailBuilder()
            .setSendTo(recipients)
            .setSubject("some subject")
            .setMessage("some message")
            .setCcMe(false)
            .setRowIds(Arrays.asList(newRows.get(0).getId()))
            .setColumnIds(Arrays.asList(addedColumn.getId()))
            .setIncludeAttachments(false)
            .setIncludeDiscussions(false)
            .build();

    smartsheet.sheetResources().rowResources().sendRows(sheet.getId(), multiRowEmail);
  }
  public void testMoveRow() throws SmartsheetException, IOException {
    List<Long> rowIds = new ArrayList<Long>();
    rowIds.add(newRows.get(0).getId());

    CopyOrMoveRowDestination destination =
        new CopyOrMoveRowDestination.InsertCopyOrMoveRowDestinationBuilder()
            .setSheetId(copyToSheet.getId())
            .build();
    CopyOrMoveRowDirective directive =
        new CopyOrMoveRowDirective.InsertCopyOrMoveRowDirectiveBuilder()
            .setRowIds(rowIds)
            .setTo(destination)
            .build();

    // smartsheet.sheetResources().rowResources().moveRows(sheet.getId(), null, null, directive);
    smartsheet
        .sheetResources()
        .rowResources()
        .moveRows(
            sheet.getId(),
            EnumSet.of(RowMoveInclusion.ATTACHMENTS, RowMoveInclusion.DISCUSSIONS),
            false,
            directive);
  }
  public void testCopyRow() throws SmartsheetException, IOException {
    // Create new sheet to copy to
    copyToSheet = smartsheet.sheetResources().createSheet(createSheetObject());

    CopyOrMoveRowDestination destination =
        new CopyOrMoveRowDestination.InsertCopyOrMoveRowDestinationBuilder()
            .setSheetId(copyToSheet.getId())
            .build();
    CopyOrMoveRowDirective copyOrMoveRowDirective =
        new CopyOrMoveRowDirective.InsertCopyOrMoveRowDirectiveBuilder()
            .setRowIds(Arrays.asList(newRows.get(0).getId()))
            .setTo(destination)
            .build();

    smartsheet
        .sheetResources()
        .rowResources()
        .copyRows(sheet.getId(), null, null, copyOrMoveRowDirective);
    smartsheet
        .sheetResources()
        .rowResources()
        .copyRows(
            sheet.getId(), EnumSet.of(RowCopyInclusion.CHILDREN), false, copyOrMoveRowDirective);
  }