コード例 #1
0
  public void testMoveListElement() throws Throwable {
    this.initContent();
    this.initAction("/do/jacms/Content", "moveListElement");
    this.addParameter("attributeName", "Autori");
    this.addParameter("elementIndex", "1");
    this.addParameter("listLangCode", "it");
    this.addParameter("movement", IListAttributeAction.MOVEMENT_UP_CODE);
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    Content currentContent = this.getContentOnEdit();
    MonoListAttribute monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
    List<AttributeInterface> attributes = monoListAttribute.getAttributes();
    String[] expected = {"Paperino", "Pippo", "Pluto"};
    this.verifyText(attributes, expected);

    this.initAction("/do/jacms/Content", "moveListElement");
    this.addParameter("attributeName", "Autori");
    this.addParameter("elementIndex", "1");
    this.addParameter("listLangCode", "it");
    this.addParameter("movement", IListAttributeAction.MOVEMENT_DOWN_CODE);
    result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    currentContent = this.getContentOnEdit();
    monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
    attributes = monoListAttribute.getAttributes();
    String[] expected2 = {"Paperino", "Pluto", "Pippo"};
    this.verifyText(attributes, expected2);
  }
コード例 #2
0
 private void initContent() throws Throwable {
   this.executeEdit("ART1", "admin");
   Content currentContent = this.getContentOnEdit();
   MonoListAttribute monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
   List<AttributeInterface> attributes = monoListAttribute.getAttributes();
   String[] expected = {"Pippo", "Paperino", "Pluto"};
   this.verifyText(attributes, expected);
 }