Search in sources :

Example 1 with ByteArray

use of org.scijava.util.ByteArray in project imagej-omero by imagej.

the class UploadTableTest method testByteArrayTable.

@Test
public void testByteArrayTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
    final GenericTable table = new DefaultGenericTable();
    final DefaultColumn<ByteArray> ij0 = new DefaultColumn<>(ByteArray.class);
    final DefaultColumn<ByteArray> ij1 = new DefaultColumn<>(ByteArray.class);
    ij0.add(new ByteArray(new byte[] { -128, 127 }));
    ij0.add(new ByteArray(new byte[] { 0, 10 }));
    ij1.add(new ByteArray(new byte[] { 112, 42 }));
    ij1.add(new ByteArray(new byte[] { -13, -84 }));
    table.add(ij0);
    table.add(ij1);
    // 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, Long[].class);
        }
    };
}
Also used : DefaultGenericTable(net.imagej.table.DefaultGenericTable) DefaultColumn(net.imagej.table.DefaultColumn) GenericTable(net.imagej.table.GenericTable) DefaultGenericTable(net.imagej.table.DefaultGenericTable) ByteArray(org.scijava.util.ByteArray) Verifications(mockit.Verifications) TableData(omero.gateway.model.TableData) Test(org.junit.Test)

Aggregations

Verifications (mockit.Verifications)1 DefaultColumn (net.imagej.table.DefaultColumn)1 DefaultGenericTable (net.imagej.table.DefaultGenericTable)1 GenericTable (net.imagej.table.GenericTable)1 TableData (omero.gateway.model.TableData)1 Test (org.junit.Test)1 ByteArray (org.scijava.util.ByteArray)1