Search in sources :

Example 1 with FloatTable

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

the class UploadTableTest method testFloatTable.

@Test
public void testFloatTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
    final FloatTable table = new DefaultFloatTable(4, 2);
    table.get(0).fill(new float[] { -380129.125f, 0.25f });
    table.get(1).fill(new float[] { 9871234.0f, -12.5f });
    table.get(2).fill(new float[] { 0.0625f, 13208.03125f });
    table.get(3).fill(new float[] { -0.0625f, 1908471790.5f });
    final String[] headers = new String[] { "H1", "H2", "H3", "H4" };
    for (int i = 0; i < table.getColumnCount(); i++) {
        table.get(i).setHeader(headers[i]);
    }
    // Create expectations
    setUpMethodCalls();
    final long id = service.uploadTable(credentials, "table", table, 0);
    assertEquals(id, -1);
    // NB: Can only capture in a Verifications block
    new Verifications() {

        {
            TableData td;
            tablesFacility.addTable((SecurityContext) any, (ImageData) any, anyString, td = withCapture());
            tableEquals(table, td, Double.class);
        }
    };
}
Also used : FloatTable(net.imagej.table.FloatTable) DefaultFloatTable(net.imagej.table.DefaultFloatTable) DefaultFloatTable(net.imagej.table.DefaultFloatTable) Verifications(mockit.Verifications) TableData(omero.gateway.model.TableData) Test(org.junit.Test)

Aggregations

Verifications (mockit.Verifications)1 DefaultFloatTable (net.imagej.table.DefaultFloatTable)1 FloatTable (net.imagej.table.FloatTable)1 TableData (omero.gateway.model.TableData)1 Test (org.junit.Test)1