Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Nov 18, 2024
1 parent 1ade5c0 commit 9657982
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* Case 2: Process key-value attributes for scenarios.
*/
public class AttributeReporter extends ScenarioReporter {
public static final String TAG_PREFIX = "@";
public static final String ATTRIBUTE_VALUE_SEPARATOR = ":";
public static final String TEST_TRACKING_TICKET_PREFIX = "JIRA";

Expand Down Expand Up @@ -76,14 +77,15 @@ private static void processAttributes(StartTestItemRQ rq) {
if (attr.contains(ATTRIBUTE_VALUE_SEPARATOR)) {
// split attribute value by separator and create an attribute object with key-value
String[] parts = attr.split(ATTRIBUTE_VALUE_SEPARATOR, 2);
return new ItemAttributesRQ(parts[0].trim(), parts[1].trim());
} else if (attr.startsWith(TEST_TRACKING_TICKET_PREFIX)) {
// Also strip tag prefix (usually redundant '@')
return new ItemAttributesRQ(parts[0].trim().substring(TAG_PREFIX.length()), parts[1].trim());
} else if (attr.startsWith(TAG_PREFIX + TEST_TRACKING_TICKET_PREFIX)) {
// set Test Case ID if attribute starts with a specific prefix
rq.setTestCaseId(attr);
rq.setTestCaseId(attr.substring(TAG_PREFIX.length())); // strip tag prefix to make Test Case ID equal to real ticket ID
return null;
} else {
// Leave attribute as Tag in all other cases
return new ItemAttributesRQ(null, attr);
return new ItemAttributesRQ(null, attr.substring(TAG_PREFIX.length())); // strip tag prefix (usually redundant '@')
}
}).filter(Objects::nonNull).collect(Collectors.toUnmodifiableSet()));
}
Expand Down

0 comments on commit 9657982

Please sign in to comment.