public static String update(Tree<Location> entityTree, DetailedLink link) {
    Object[] result = HeaderUtils.generateMethodParams(link);
    String headersMethodParamsStr = (String) result[0];
    String headersMapParamsStr = (String) result[1];

    headersMethodParamsStr = !headersMethodParamsStr.isEmpty() ? ", " + headersMethodParamsStr : "";

    ResourceUpdateTemplate template = new ResourceUpdateTemplate();
    template.set("url", link.getHref());
    template.set("entity_name", LocationRules.getName(entityTree));
    template.set("entity_broker_type", BrokerRules.getBrokerType(entityTree));
    template.set("docs", Documentation.document(link));
    template.set("headers_map_params_str", headersMapParamsStr);
    template.set("headers_method_params_str", headersMethodParamsStr);

    return template.evaluate();
  }
  public static String delete(Tree<Location> entityTree, DetailedLink link) {
    Object[] result = ParamUtils.getMethodParamsByUrlParamsMeta(link);
    String prmsStr = (String) result[0];
    Map<String, String> methodParams = (Map<String, String>) result[1];
    Map<String, String> urlParams = (Map<String, String>) result[2];

    result = HeaderUtils.generateMethodParams(link);
    String headersMethodParamsStr = (String) result[0];
    String headersMapParamsStr = (String) result[1];

    StringBuilder combinedMethodParamsBuffer = new StringBuilder();
    if (prmsStr != null && !prmsStr.isEmpty()) {
      if (combinedMethodParamsBuffer.length() > 0) {
        combinedMethodParamsBuffer.append(", ");
      }
      combinedMethodParamsBuffer.append(prmsStr);
    }
    if (headersMethodParamsStr != null && !headersMethodParamsStr.isEmpty()) {
      if (combinedMethodParamsBuffer.length() > 0) {
        combinedMethodParamsBuffer.append(", ");
      }
      combinedMethodParamsBuffer.append(headersMethodParamsStr);
    }
    String combinedMethodParams = combinedMethodParamsBuffer.toString();

    String bodyInstance = ParamUtils.getBodyInstance(link);
    String bodyInstanceStr = !bodyInstance.isEmpty() ? "=" + bodyInstance : "";

    String bodyType = null;
    if (link.isSetRequest() && link.getRequest().isSetBody()) {
      bodyType = link.getRequest().getBody().getType();
    }

    Map<String, String> values = new LinkedHashMap<>();
    values.put("url", link.getHref());
    values.put("body_type", bodyType);
    values.put("resource_name_lc", LocationRules.getName(entityTree));
    values.put("body_type_lc", bodyType != null ? bodyType.toLowerCase() : null);
    values.put("combined_method_params", combinedMethodParams);
    values.put(
        "headers_map_params_str_with_no_ct",
        !headersMapParamsStr.equals("{}")
            ? headersMapParamsStr.replace("}", ",\"Content-type\":None}")
            : "{\"Content-type\":None}");
    values.put("url_params", ParamUtils.toDictStr(urlParams.keySet(), methodParams.keySet()));
    values.put("body_instance_str", bodyInstanceStr);
    values.put("headers_map_params_str", headersMapParamsStr);

    AbstractTemplate resourceDeleteTemplate;
    AbstractTemplate bodyResourceDeleteTemplate;
    if (!prmsStr.isEmpty() || !headersMethodParamsStr.isEmpty()) {
      values.put("docs", Documentation.document(link, new LinkedHashMap<>(), methodParams));

      resourceDeleteTemplate = new ResourceDeleteWithParamsTemplate();
      bodyResourceDeleteTemplate = new ResourceDeleteWithBodyTemplate();
    } else {
      values.put("docs", Documentation.document(link));

      resourceDeleteTemplate = new ResourceDeleteTemplate();
      bodyResourceDeleteTemplate = new ResourceDeleteWithBodyAndParamsTemplate();
    }

    if (bodyType == null || bodyType.isEmpty()) {
      resourceDeleteTemplate.set(values);
      return resourceDeleteTemplate.evaluate();
    } else {
      bodyResourceDeleteTemplate.set(values);
      return bodyResourceDeleteTemplate.evaluate();
    }
  }
 @Test
 public void testToString() {
   assertTrue(!"".equals(documentation.toString()));
 }
 @Test
 public void testGetContents() {
   assertEquals(CONTENTS, documentation.getContents());
 }
 @Test
 public void testGetLanguage() {
   assertEquals(LANGUAGE, documentation.getLanguage());
 }
 @Test
 public void testGetTitle() {
   assertEquals(TITLE, documentation.getTitle());
 }
  /**
   * Calling this method will execute the interaction with the given id.
   *
   * @param interactionID The id that specifies the interaction
   * @throws UnknownInteractionException Thrown if interactionID is an unknown id.
   */
  public void interaction(String interactionID) throws UnknownInteractionException {
    // boolean displayAnswer;
    boolean guiBuilded;
    String groupID;
    GroupInfo group;
    Dimension theSize;
    int i;

    if (DEBUG)
      System.out.println("\ninteraction was called\n\tinteractionID=\"" + interactionID + "\"");

    if (!allInteractions.containsKey(interactionID))
      throw (new UnknownInteractionException(
          "Interaction \"" + interactionID + "\" does not exist"));

    if (allInteractions.get(interactionID) instanceof Question) {
      Question aQuestion = (Question) allInteractions.get(interactionID);

      aQuestion.addSubmitListener(this);

      // get group id
      groupID = aQuestion.getGroupID();
      // lookup group infos
      group = (GroupInfo) groupInfos.get(groupID);
      if ((groupID != "") && (group != null)) {
        // if amount of correct questions of group
        // already reached we dont have to
        // continue with this interaction
        if ((group.processed >= group.repeats) && (group.processed != 0) && (group.repeats != 0)) {
          if (DEBUG)
            System.out.println("\t\tNecessary amount of questions of group " + "answered correct.");

          return;
        }
      }

      guiBuilded = aQuestion.getGuiBuilded();
      if (guiBuilded) aQuestion.rebuildQuestion();
      else aQuestion.makeGUI();

      aQuestion.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      JDialog jdialog = getJDialog(aQuestion.getTitle());
      // theFrame = new JFrame(aQuestion.getTitle());

      aQuestion.setJDialog(jdialog);

      for (i = 0; i < windowListeners.size(); i++)
        jdialog.addWindowListener((WindowListener) (windowListeners.elementAt(i)));

      jdialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
      jdialog.setBackground(new Color(192, 192, 192));
      jdialog.getContentPane().add(aQuestion, BorderLayout.CENTER);
      jdialog.pack();
      theSize = jdialog.getSize();
      jdialog.setSize(350, theSize.height);
      // jdialog.pack();
      jdialog.setLocationRelativeTo(null);
      jdialog.setVisible(true);
      jdialog.requestFocus();
      // theFrame.show();

      // Processing of the interaction will be handled by
      // the event loop.
    } else if (allInteractions.get(interactionID) instanceof Documentation) {
      Documentation doc = (Documentation) allInteractions.get(interactionID);
      doc.makeGUI();
      doc.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      JFrame theFrame = new JFrame("Documentation");

      theFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

      theFrame.getContentPane().add(doc, BorderLayout.CENTER);

      for (i = 0; i < windowListeners.size(); i++)
        theFrame.addWindowListener((WindowListener) (windowListeners.elementAt(i)));

      theFrame.setSize(400, 500);
      // theFrame.pack();
      theFrame.setLocationRelativeTo(null);
      theFrame.setVisible(true);
      theFrame.requestFocus();
      // theFrame.show();

      // no need to handle anything by the event loop.
    }
    return;
  }