benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

Search table cell by content #188

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From conversation with Jason Goodwin:

To solve your problem, add the following methods to
org.fest.swing.fixture.JTableFixture:

  public JTableCellFixture cell(String value) {
    int rowCount = target.getRowCount();
    int columnCount = target.getColumnCount();
    for (int row = 0; row < rowCount; row++)
      for (int column = 0; column < columnCount; column++)
        if (cellContainsValue(row, column, value)) return new
JTableCellFixture(this, row(row).column(column));
    throw actionFailure(concat("Unable to find cell with value ",
quote(value)));
  }

  private boolean cellContainsValue(int row, int column, String value) {
    return areEqual(value, driver.value(target, row, column));
  }

You will need to add the following static imports:

import static org.fest.util.Strings.*;
import static org.fest.util.Objects.*;
import static org.fest.swing.fixture.TableCell.*;
import static org.fest.swing.exception.ActionFailedException.*;

Original issue reported on code.google.com by Alex.Rui...@gmail.com on 29 Jul 2008 at 2:52

GoogleCodeExporter commented 9 years ago
Added method 'cell(String)' to org.fest.swing.fixture.JTableFixture. This method
returns a table cell which value matches the given one.

Original comment by Alex.Rui...@gmail.com on 13 Oct 2008 at 3:38

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 2:11