test_class.declarator: ATTRIB1_CONTENT = "    <boringAttribute>" +
                                                    "      <field>" +
                                                    "        <name>color</name>" +
                                                    "        <value>green</value>" +
                                                    "      </field>" +
                                                    "      <field>" +
                                                    "        <name>shape</name>" +
                                                    "        <value>circle</value>" +
                                                    "      </field>" +
                                                    "    </boringAttribute>"
test_class.modifier: private static final
test_class.original_string: private static final String ATTRIB1_CONTENT = "    <boringAttribute>" +
                                                    "      <field>" +
                                                    "        <name>color</name>" +
                                                    "        <value>green</value>" +
                                                    "      </field>" +
                                                    "      <field>" +
                                                    "        <name>shape</name>" +
                                                    "        <value>circle</value>" +
                                                    "      </field>" +
                                                    "    </boringAttribute>";
test_class.type: String
test_class.var_name: ATTRIB1_CONTENT
test_class.declarator: ATTRIB2_CONTENT = "    <coolAttribute>" +
                                                    "      <field>" +
                                                    "        <name>car</name>" +
                                                    "        <value>KIT</value>" +
                                                    "      </field>" +
                                                    "      <field>" +
                                                    "        <name>driver</name>" +
                                                    "        <value>hasselhof</value>" +
                                                    "      </field>" +
                                                    "    </coolAttribute>"
test_class.modifier: private static final
test_class.original_string: private static final String ATTRIB2_CONTENT = "    <coolAttribute>" +
                                                    "      <field>" +
                                                    "        <name>car</name>" +
                                                    "        <value>KIT</value>" +
                                                    "      </field>" +
                                                    "      <field>" +
                                                    "        <name>driver</name>" +
                                                    "        <value>hasselhof</value>" +
                                                    "      </field>" +
                                                    "    </coolAttribute>";
test_class.type: String
test_class.var_name: ATTRIB2_CONTENT
test_class.declarator: ATTRIB2_CONTENT_REVERSED = "    <coolAttribute>" +
                                                             "      <field>" +
                                                              "        <name>driver</name>" +
                                                              "        <value>hasselhof</value>" +
                                                              "      </field>" +
                                                              "      <field>" +
                                                              "        <name>car</name>" +
                                                              "        <value>KIT</value>" +
                                                              "      </field>" +
                                                              "    </coolAttribute>"
test_class.modifier: private static final
test_class.original_string: private static final String ATTRIB2_CONTENT_REVERSED = "    <coolAttribute>" +
                                                             "      <field>" +
                                                              "        <name>driver</name>" +
                                                              "        <value>hasselhof</value>" +
                                                              "      </field>" +
                                                              "      <field>" +
                                                              "        <name>car</name>" +
                                                              "        <value>KIT</value>" +
                                                              "      </field>" +
                                                              "    </coolAttribute>";
test_class.type: String
test_class.var_name: ATTRIB2_CONTENT_REVERSED
test_class.declarator: TEST_CONTENT = "<documentContent>" +
                                                 "  <attributeContent>" +
                                                 ATTRIB1_CONTENT +
                                                 ATTRIB2_CONTENT +
                                                 "  </attributeContent>" +
                                                 "</documentContent>"
test_class.modifier: private static final
test_class.original_string: private static final String TEST_CONTENT = "<documentContent>" +
                                                 "  <attributeContent>" +
                                                 ATTRIB1_CONTENT +
                                                 ATTRIB2_CONTENT +
                                                 "  </attributeContent>" +
                                                 "</documentContent>";
test_class.type: String
test_class.var_name: TEST_CONTENT
test_class.file: rice-middleware/impl/src/test/java/org/kuali/rice/kew/rule/GenericAttributeContentTest.java
test_class.identifier: GenericAttributeContentTest
test_case.body: @Test public void testGenerateContent() throws Exception {
          DocumentContent dc = new StandardDocumentContent(TEST_CONTENT);
          GenericAttributeContent gac = new GenericAttributeContent("boringAttribute");
          List<Map<String, String>> attrs = gac.parseContent(dc.getAttributeContent());
          assertEquals(1, attrs.size());
          Map<String, String> properties = attrs.get(0);
          assertEquals(2, properties.size());
          assertEquals("green", properties.get("color"));
          assertEquals("circle", properties.get("shape"));
          String content = gac.generateContent(properties);
          assertEquals(content.replaceAll("\\s+", ""), ATTRIB1_CONTENT.replaceAll("\\s+", ""));
  
          gac = new GenericAttributeContent("coolAttribute");
          attrs = gac.parseContent(dc.getAttributeContent());
          assertEquals(1, attrs.size());
          properties = attrs.get(0);
          assertEquals(2, properties.size());
          assertEquals("hasselhof", properties.get("driver"));
          assertEquals("KIT", properties.get("car"));
          content = gac.generateContent(properties);
  
          // order is not guaranteed
          List<String> validValues = Arrays.asList(ATTRIB2_CONTENT.replaceAll("\\s+", ""), ATTRIB2_CONTENT_REVERSED.replaceAll(
                  "\\s+", ""));
          content = content.replaceAll("\\s+", "");
          assertTrue(validValues.contains(content));
      }
test_case.class_method_signature: GenericAttributeContentTest.testGenerateContent()
test_case.full_signature: @Test public void testGenerateContent()
test_case.identifier: testGenerateContent
test_case.invocations: parseContent getAttributeContent assertEquals size get assertEquals size assertEquals get assertEquals get generateContent assertEquals replaceAll replaceAll parseContent getAttributeContent assertEquals size get assertEquals size assertEquals get assertEquals get generateContent asList replaceAll replaceAll replaceAll assertTrue contains
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateContent()
focal_class.declarator: NAME_EXPR
focal_class.modifier: private static final
focal_class.original_string: private static final XPathExpression NAME_EXPR;
focal_class.type: XPathExpression
focal_class.var_name: NAME_EXPR
focal_class.declarator: VALUE_EXPR
focal_class.modifier: private static final
focal_class.original_string: private static final XPathExpression VALUE_EXPR;
focal_class.type: XPathExpression
focal_class.var_name: VALUE_EXPR
focal_class.declarator: FIELD_EXPR
focal_class.modifier: private static final
focal_class.original_string: private static final XPathExpression FIELD_EXPR;
focal_class.type: XPathExpression
focal_class.var_name: FIELD_EXPR
focal_class.declarator: log
focal_class.modifier: private final
focal_class.original_string: private final Logger log;
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: elementName
focal_class.modifier: private final
focal_class.original_string: private final String elementName;
focal_class.type: String
focal_class.var_name: elementName
focal_class.declarator: attr_expr
focal_class.modifier: private final
focal_class.original_string: private final XPathExpression attr_expr;
focal_class.type: XPathExpression
focal_class.var_name: attr_expr
focal_class.file: rice-middleware/impl/src/main/java/org/kuali/rice/kew/rule/GenericAttributeContent.java
focal_class.identifier: GenericAttributeContent
focal_class.class_method_signature: GenericAttributeContent.GenericAttributeContent(Class clazz)
focal_class.full_signature: public  GenericAttributeContent(Class clazz)
focal_class.identifier: GenericAttributeContent
focal_class.modifiers: public
focal_class.parameters: (Class clazz)
focal_class.signature:  GenericAttributeContent(Class clazz)
focal_class.class_method_signature: GenericAttributeContent.GenericAttributeContent(String elementName)
focal_class.full_signature: public  GenericAttributeContent(String elementName)
focal_class.identifier: GenericAttributeContent
focal_class.modifiers: public
focal_class.parameters: (String elementName)
focal_class.signature:  GenericAttributeContent(String elementName)
focal_class.class_method_signature: GenericAttributeContent.generateContent(Map<String, String> properties)
focal_class.full_signature: public String generateContent(Map<String, String> properties)
focal_class.identifier: generateContent
focal_class.modifiers: public
focal_class.parameters: (Map<String, String> properties)
focal_class.return: String
focal_class.signature: String generateContent(Map<String, String> properties)
focal_class.class_method_signature: GenericAttributeContent.parseContent(Element attributeContent)
focal_class.full_signature: public List<Map<String, String>> parseContent(Element attributeContent)
focal_class.identifier: parseContent
focal_class.modifiers: public
focal_class.parameters: (Element attributeContent)
focal_class.return: List<Map<String, String>>
focal_class.signature: List<Map<String, String>> parseContent(Element attributeContent)
focal_method.body: public String generateContent(Map<String, String> properties) {
          if (properties.size() == 0) return "<" + elementName + "/>";
  
          StringBuilder sb = new StringBuilder();
          sb.append("<" + elementName + ">\r\n");
          for (Map.Entry<String, String> entry: properties.entrySet()) {
              String key = entry.getKey();
              sb.append("  <field>\r\n");
              if (key != null) {
                  sb.append("    <name>" + key + "</name>\r\n");
              } else {
                  log.warn("null key encountered");
              }
              String value = entry.getValue();
              if (value != null) {
                  sb.append("    <value>" + entry.getValue() + "</value>\r\n");
              } else {
                  log.warn("null value encountered for key: " + key);
              }
              sb.append("  </field>\r\n");
          }
          sb.append("</" + elementName + ">\r\n");
  
          return sb.toString();
      }
focal_method.class_method_signature: GenericAttributeContent.generateContent(Map<String, String> properties)
focal_method.full_signature: public String generateContent(Map<String, String> properties)
focal_method.identifier: generateContent
focal_method.invocations: size append entrySet getKey append append warn getValue append getValue warn append append toString
focal_method.modifiers: public
focal_method.parameters: (Map<String, String> properties)
focal_method.return: String
focal_method.signature: String generateContent(Map<String, String> properties)