Skip to content

Commit

Permalink
MarkdownUtils.asTwoParts now correctly joins two document parts wit…
Browse files Browse the repository at this point in the history
…h separation line
  • Loading branch information
HardNorth committed Dec 26, 2024
1 parent d7649c7 commit 1987618
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Fixed
- `MarkdownUtils.asTwoParts` now correctly joins two document parts with separation line, by @HardNorth

## [5.2.23]
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand All @@ -39,7 +40,7 @@ public class MarkdownUtils {
public static final int PADDING_SPACES_NUM = 2;
public static final int MAX_TABLE_SIZE = 83;
public static final int MIN_COL_SIZE = 3;
public static final String LOGICAL_SEPARATOR = "---";
public static final String LOGICAL_SEPARATOR = NEW_LINE + NEW_LINE + "---" + NEW_LINE + NEW_LINE;

private MarkdownUtils() {
throw new IllegalStateException("Static only class");
Expand All @@ -51,7 +52,8 @@ private MarkdownUtils() {
* @param message Message
* @return Message with markdown marker
*/
public static String asMarkdown(String message) {
@Nonnull
public static String asMarkdown(@Nonnull String message) {
return MARKDOWN_MODE.concat(message);
}

Expand All @@ -62,7 +64,8 @@ public static String asMarkdown(String message) {
* @param script Script
* @return Message to be sent to ReportPortal
*/
public static String asCode(String language, String script) {
@Nonnull
public static String asCode(@Nullable String language, @Nullable String script) {
return asMarkdown("```" + ofNullable(language).orElse("") + NEW_LINE + script + NEW_LINE + "```");
}

Expand Down Expand Up @@ -202,7 +205,8 @@ public static String formatDataTable(@Nonnull final Map<String, String> table) {
return formatDataTable(toFormat);
}

@Nonnull
public static String asTwoParts(@Nonnull String firstPart, @Nonnull String secondPart) {
return firstPart + NEW_LINE + LOGICAL_SEPARATOR + NEW_LINE + secondPart;
return firstPart + LOGICAL_SEPARATOR + secondPart;
}
}

0 comments on commit 1987618

Please sign in to comment.