public void testClone() throws Exception {
    PortletContext original =
        PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE, false);
    PortletContext clone = consumer.createClone(PortletStateType.OPAQUE, original);
    ExtendedAssert.assertNotNull(clone);
    ExtendedAssert.assertFalse(original.equals(clone));
    ExtendedAssert.assertEquals(BasicPortletManagementBehavior.CLONED_HANDLE, clone.getId());

    Portlet originalPortlet = consumer.getPortlet(original);
    Portlet clonePortlet = consumer.getPortlet(clone);
    ExtendedAssert.assertNotNull(clonePortlet);
    ExtendedAssert.assertFalse(originalPortlet.getContext().equals(clonePortlet.getContext()));

    // information about the portlet should be the same
    MetaInfo originalInfo = originalPortlet.getInfo().getMeta();
    MetaInfo cloneInfo = clonePortlet.getInfo().getMeta();
    ExtendedAssert.assertEquals(
        originalInfo.getMetaValue(MetaInfo.TITLE), cloneInfo.getMetaValue(MetaInfo.TITLE));
    ExtendedAssert.assertEquals(
        originalInfo.getMetaValue(MetaInfo.DESCRIPTION),
        cloneInfo.getMetaValue(MetaInfo.DESCRIPTION));
  }
  private V1MarkupContext checkMarkupResponse(V1MarkupResponse response, String markupString) {
    ExtendedAssert.assertNotNull(response);

    // Markup context
    V1MarkupContext markupContext = response.getMarkupContext();
    ExtendedAssert.assertNotNull(markupContext);
    ExtendedAssert.assertEquals("text/html", markupContext.getMimeType());
    ExtendedAssert.assertEquals("title", markupContext.getPreferredTitle());
    if (!ParameterValidation.isNullOrEmpty(markupString)) {
      ExtendedAssert.assertTrue(markupContext.isRequiresUrlRewriting());
    } else {
      ExtendedAssert.assertFalse(markupContext.isRequiresUrlRewriting());
    }
    ExtendedAssert.assertEquals(markupString, markupContext.getMarkupString());

    // Session context
    V1SessionContext sessionContext = response.getSessionContext();
    // The session information is should never be sent to the consumer, Cookies are used instead.
    ExtendedAssert.assertNull(sessionContext);

    return markupContext;
  }