@Test
  public void response_ok_for_request_to_content_image_that_binary_is_not_on_main_version()
      throws Exception {
    // setup: content
    byte[] bytes = loadImage("Arn.JPG");
    ContentKey contentKey =
        createImageContent(
            "MyImage.jpg", 2, bytes, "ImageCategory", new DateTime(2011, 6, 27, 10, 0, 0, 0), null);

    // setup: draft version of content
    ContentEntity content = fixture.findContentByKey(contentKey);
    ContentVersionEntity draftVersion = createDraftVersion("Arn.JPG");
    draftVersion.setContentDataXml(content.getMainVersion().getContentDataAsXmlString());
    content.setDraftVersion(draftVersion);
    content.addVersion(draftVersion);
    fixture.save(draftVersion);

    BinaryDataEntity binaryDataForDraftVersion = factory.createBinaryData("Arn.JPG", bytes.length);
    binaryDataForDraftVersion.setBlobKey(
        content.getMainVersion().getBinaryData("source").getBlobKey());
    fixture.save(binaryDataForDraftVersion);

    ContentBinaryDataEntity contentBinaryDataForDraftVersion =
        factory.createContentBinaryData("source", binaryDataForDraftVersion, draftVersion);
    draftVersion.addContentBinaryData(contentBinaryDataForDraftVersion);
    fixture.save(contentBinaryDataForDraftVersion);

    fixture.flushAndClearHibernateSesssion();

    // exercise & verify
    String imageRequestPath = "_image/" + contentKey + "/label/source.jpg";
    setPathInfoAndRequestURI(httpServletRequest, imageRequestPath);
    httpServletRequest.setParameter("_version", draftVersion.getKey().toString());
    httpServletRequest.setParameter("_background", "0xffffff");
    httpServletRequest.setParameter("_quality", "100");

    imageController.handleRequestInternal(httpServletRequest, httpServletResponse);

    assertEquals(HttpServletResponse.SC_OK, httpServletResponse.getStatus());
    assertTrue("Content Length", httpServletResponse.getContentLength() > 0);
    assertEquals("image/jpg", httpServletResponse.getContentType());
  }