Source:
<code>public void testMultiviewPictureAdapter() throws IOException { DocumentModel picture = session.createDocumentModel("/", "picture", "Picture"); picture = session.createDocument(picture); MultiviewPicture mvp = picture.getAdapter(MultiviewPicture.class); PictureView[] views = mvp.getViews(); assertEquals(5, views.length); String path = ImagingResourcesHelper.TEST_DATA_FOLDER + "cat.gif"; Blob blob = Blobs.createBlob(ImagingResourcesHelper.getFileFromPath(path)); ImageInfo info = imagingService.getImageInfo(blob); PictureView view = new PictureViewImpl(); view.setBlob(blob); view.setDescription("a view"); view.setFilename("cat.gif"); view.setHeight(info.getHeight()); view.setImageInfo(info); view.setTitle("a view"); view.setWidth(info.getWidth()); mvp.addView(view); session.saveDocument(picture); picture = session.getDocument(picture.getRef()); mvp = picture.getAdapter(MultiviewPicture.class); views = mvp.getViews(); assertEquals(6, views.length); view = mvp.getView("a view"); info = view.getImageInfo(); assertNotEquals(0, info.getWidth()); assertNotEquals(0, info.getHeight()); assertNotEquals(0, info.getDepth()); assertNotNull(info.getColorSpace()); assertNotNull(info.getFormat()); view = mvp.getView("Thumbnail"); info = view.getImageInfo(); assertNotEquals(0, info.getWidth()); assertNotEquals(0, info.getHeight()); assertNotEquals(0, info.getDepth()); assertNotNull(info.getColorSpace()); assertNotNull(info.getFormat()); <START> PictureView picView = mvp.getView("Medium"); <END> ImageInfo imageBlobInfo = imagingService.getImageInfo(picView.getBlob()); ImageInfo resizedImageInfo = picView.getImageInfo(); assertEquals(imageBlobInfo.getHeight(), resizedImageInfo.getHeight()); assertEquals(imageBlobInfo.getWidth(), resizedImageInfo.getWidth()); assertEquals(imageBlobInfo.getWidth(), picView.getWidth()); assertEquals(imageBlobInfo.getHeight(), picView.getHeight()); }</code><technical_language>For consistency, could've reused view instead of instantiating a new variable</technical_language>

Target:
public void testMultiviewPictureAdapter() throws IOException { DocumentModel picture = session.createDocumentModel("/", "picture", "Picture"); picture = session.createDocument(picture); MultiviewPicture mvp = picture.getAdapter(MultiviewPicture.class); PictureView[] views = mvp.getViews(); assertEquals(5, views.length); String path = ImagingResourcesHelper.TEST_DATA_FOLDER + "cat.gif"; Blob blob = Blobs.createBlob(ImagingResourcesHelper.getFileFromPath(path)); ImageInfo info = imagingService.getImageInfo(blob); PictureView view = new PictureViewImpl(); view.setBlob(blob); view.setDescription("a view"); view.setFilename("cat.gif"); view.setHeight(info.getHeight()); view.setImageInfo(info); view.setTitle("a view"); view.setWidth(info.getWidth()); mvp.addView(view); session.saveDocument(picture); picture = session.getDocument(picture.getRef()); mvp = picture.getAdapter(MultiviewPicture.class); views = mvp.getViews(); assertEquals(6, views.length); view = mvp.getView("a view"); info = view.getImageInfo(); assertNotEquals(0, info.getWidth()); assertNotEquals(0, info.getHeight()); assertNotEquals(0, info.getDepth()); assertNotNull(info.getColorSpace()); assertNotNull(info.getFormat()); view = mvp.getView("Thumbnail"); info = view.getImageInfo(); assertNotEquals(0, info.getWidth()); assertNotEquals(0, info.getHeight()); assertNotEquals(0, info.getDepth()); assertNotNull(info.getColorSpace()); assertNotNull(info.getFormat()); view = mvp.getView("Medium"); ImageInfo imageBlobInfo = imagingService.getImageInfo(view.getBlob()); info = view.getImageInfo(); assertEquals(imageBlobInfo.getWidth(), info.getWidth()); assertEquals(imageBlobInfo.getWidth(), view.getWidth()); assertEquals(imageBlobInfo.getHeight(), info.getHeight()); assertEquals(imageBlobInfo.getHeight(), view.getHeight()); }