Search in sources :

Example 56 with Verifications

use of mockit.Verifications in project docker-maven-plugin by fabric8io.

the class DockerAssemblyManagerTest method testCopyChownValidVerifyGivenDockerfile.

@Test
public void testCopyChownValidVerifyGivenDockerfile(@Injectable final Logger logger) throws IOException {
    BuildImageConfiguration buildConfig = createBuildConfig();
    assemblyManager.verifyGivenDockerfile(new File(getClass().getResource("/docker/Dockerfile_assembly_verify_copy_chown_valid.test").getPath()), buildConfig, createInterpolator(buildConfig), logger);
    new Verifications() {

        {
            logger.warn(anyString, (Object[]) any);
            times = 0;
        }
    };
}
Also used : Verifications(mockit.Verifications) File(java.io.File) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Example 57 with Verifications

use of mockit.Verifications 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)

Example 58 with Verifications

use of mockit.Verifications 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)

Example 59 with Verifications

use of mockit.Verifications in project imagej-omero by imagej.

the class UploadTableTest method testCharTable.

@Test
public void testCharTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
    final CharTable table = new DefaultCharTable(5, 2);
    table.get(0).fill(new char[] { 'q', 'V' });
    table.get(1).fill(new char[] { '2', '$' });
    table.get(2).fill(new char[] { 'b', 'a' });
    table.get(3).fill(new char[] { '\t', '\n' });
    table.get(4).fill(new char[] { '.', ' ' });
    // 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, String.class);
        }
    };
}
Also used : DefaultCharTable(net.imagej.table.DefaultCharTable) Verifications(mockit.Verifications) TableData(omero.gateway.model.TableData) DefaultCharTable(net.imagej.table.DefaultCharTable) CharTable(net.imagej.table.CharTable) Test(org.junit.Test)

Example 60 with Verifications

use of mockit.Verifications in project imagej-omero by imagej.

the class UploadTableTest method testReferenceTable.

@Test
public void testReferenceTable() throws ServerError, PermissionDeniedException, CannotCreateSessionException, ExecutionException, DSOutOfServiceException, DSAccessException {
    final GenericTable table = new DefaultGenericTable();
    final OMERORefColumn rc0 = new OMERORefColumn(OMERORef.WELL);
    final OMERORefColumn rc1 = new OMERORefColumn(OMERORef.WELL);
    final OMERORefColumn rc2 = new OMERORefColumn(OMERORef.WELL);
    rc0.fill(new long[] { 2314, 3141324, 1235 });
    rc1.fill(new long[] { 1234, 18367, 82156 });
    rc2.fill(new long[] { 3198, 968431, 5489 });
    table.add(rc0);
    table.add(rc1);
    table.add(rc2);
    final Object[][] wells = new Object[3][3];
    for (int c = 0; c < table.getColumnCount(); c++) {
        for (int r = 0; r < table.getRowCount(); r++) {
            wells[c][r] = new WellSampleData(new WellSampleI((long) table.get(c, r), false));
        }
        ((OMERORefColumn) table.get(c)).setOriginalData(wells[c]);
    }
    // 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, WellSampleData.class);
        }
    };
}
Also used : DefaultGenericTable(net.imagej.table.DefaultGenericTable) WellSampleData(omero.gateway.model.WellSampleData) GenericTable(net.imagej.table.GenericTable) DefaultGenericTable(net.imagej.table.DefaultGenericTable) DataObject(omero.gateway.model.DataObject) Verifications(mockit.Verifications) TableData(omero.gateway.model.TableData) WellSampleI(omero.model.WellSampleI) Test(org.junit.Test)

Aggregations

Verifications (mockit.Verifications)329 Test (org.junit.Test)326 NonStrictExpectations (mockit.NonStrictExpectations)163 Expectations (mockit.Expectations)52 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)34 Tuple (org.apache.storm.tuple.Tuple)28 IotHubServiceClientProtocol (com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol)24 AmqpResponseVerification (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification)22 HttpConnection (com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection)21 HttpMethod (com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod)21 ArrayList (java.util.ArrayList)21 List (java.util.List)21 DeviceTwin (com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin)20 FileUploadNotificationReceiver (com.microsoft.azure.sdk.iot.service.FileUploadNotificationReceiver)18 MqttDeviceMethod (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttDeviceMethod)17 HashMap (java.util.HashMap)16 MqttIotHubConnection (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttIotHubConnection)14 IOException (java.io.IOException)14 Values (org.apache.storm.tuple.Values)14 SaslListenerImpl (com.microsoft.azure.sdk.iot.deps.transport.amqp.SaslListenerImpl)13