Search in sources :

Example 1 with ResultsTable

use of net.imagej.table.ResultsTable in project imagej-omero by imagej.

the class DownloadTableTest method downloadDoubleTable.

@Test
public void downloadDoubleTable() throws PermissionDeniedException, CannotCreateSessionException, ServerError, DSOutOfServiceException, ExecutionException, DSAccessException {
    // Setup OMERO data structures
    final TableDataColumn[] tdc = new TableDataColumn[] { new TableDataColumn("Header 1", 0, Double.class), new TableDataColumn("Header 2", 1, Double.class) };
    final Object[][] data = new Object[2][];
    data[0] = new Double[] { 0.125, -0.5, 923014712408917.25, -241.03125, 0.0 };
    data[1] = new Double[] { 1002.125, 908082.5, 59871249.0625, -7.25, 4.5 };
    final TableData table = new TableData(tdc, data);
    table.setNumberOfRows(5);
    // Create expectations
    setUpMethodCalls(table);
    final Table<?, ?> imageJTable = ((DefaultOMEROService) service).downloadTable(credentials, 0);
    // Tests
    assertTrue(ResultsTable.class.isInstance(imageJTable));
    assertEquals(imageJTable.getColumnCount(), 2);
    assertEquals(imageJTable.getRowCount(), 5);
    assertEquals(imageJTable.getColumnHeader(0), "Header 1");
    assertEquals(imageJTable.getColumnHeader(1), "Header 2");
    for (int r = 0; r < imageJTable.getRowCount(); r++) {
        for (int c = 0; c < imageJTable.getColumnCount(); c++) {
            assertEquals((double) data[c][r], ((ResultsTable) imageJTable).get(c, r), 0);
        }
    }
}
Also used : ResultsTable(net.imagej.table.ResultsTable) TableDataColumn(omero.gateway.model.TableDataColumn) TableData(omero.gateway.model.TableData) Test(org.junit.Test)

Aggregations

ResultsTable (net.imagej.table.ResultsTable)1 TableData (omero.gateway.model.TableData)1 TableDataColumn (omero.gateway.model.TableDataColumn)1 Test (org.junit.Test)1