Exemplo n.º 1
0
    @Override
    public void verifyImageResult(long numberOfImages, ImageResult lastResult, AsyncReport report) {
      assertNotNull(report.getException());

      Class<?> receviedType = report.getException().getClass();
      assertTrue(
          "Invalid exception type: " + receviedType,
          expectedException.isAssignableFrom(receviedType));
    }
Exemplo n.º 2
0
    @Override
    public void verifyImageResult(long numberOfImages, ImageResult lastResult, AsyncReport report) {
      assertTrue("Unexpected report: " + report.toString(), report.isCanceled());
      assertTrue(
          report.getException() == null
              || report.getException() instanceof OperationCanceledException);

      if (lastResult != null) {
        ImageMetaData metaData = lastResult.getMetaData();
        assertNotNull("meta-data should not be null if image has been received.", metaData);
        assertFalse(
            "The last image should nto be complete on successful cancel",
            lastResult.getMetaData().isComplete());

        BufferedImage lastImage = lastResult.getImage();
        if (lastImage != null) {
          assertEquals(TEST_IMG_WIDTH, lastImage.getWidth());
          assertEquals(TEST_IMG_HEIGHT, lastImage.getHeight());
        }
        assertEquals(TEST_IMG_WIDTH, lastResult.getMetaData().getWidth());
        assertEquals(TEST_IMG_HEIGHT, lastResult.getMetaData().getHeight());
      }
    }