Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Oct 9, 2024
1 parent a9c6848 commit f9788d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/epam/reportportal/testng/TestNGService.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ;
import com.epam.ta.reportportal.ws.model.log.SaveLogRQ;
import io.reactivex.Maybe;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.testng.*;
Expand Down Expand Up @@ -810,9 +811,8 @@ Maybe<String> getConfigParent(ITestResult testResult, TestMethodType type) {
* @return Test/Step Description being sent to ReportPortal
*/
private String getLogMessage(ITestResult testResult) {
return MarkdownUtils.asTwoParts(
createStepDescription(testResult),
String.format(DESCRIPTION_ERROR_FORMAT, ExceptionUtils.getStackTrace(testResult.getThrowable())).trim()
);
String error = String.format(DESCRIPTION_ERROR_FORMAT, ExceptionUtils.getStackTrace(testResult.getThrowable())).trim();
return ofNullable(createStepDescription(testResult)).filter(StringUtils::isNotBlank)
.map(description -> MarkdownUtils.asTwoParts(description, error)).orElse(error);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.epam.reportportal.service.ReportPortalClient;
import com.epam.reportportal.testng.integration.feature.description.DescriptionFailedTest;
import com.epam.reportportal.utils.MemoizingSupplier;
import com.epam.reportportal.utils.markdown.MarkdownUtils;
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ;
import java.util.Calendar;
Expand Down Expand Up @@ -67,11 +68,10 @@ private static Launch getLaunch(ListenerParameters parameters) {
private final String testClassUuid = namedUuid("class");
private final String assertionError = "java.lang.AssertionError: " + ASSERT_ERROR;
private final String noSuchElementException = "java.util.NoSuchElementException: " + NO_SUCH_ELEMENT_EXCEPTION;
private final String empty = "";
private final String testDescriptionTestAssertErrorMessage = String.format(DESCRIPTION_ERROR_FORMAT, TEST_DESCRIPTION, assertionError);
private final String testDescriptionTestExceptionMessage = String.format(DESCRIPTION_ERROR_FORMAT, TEST_DESCRIPTION, noSuchElementException);
private final String testWithoutDescriptionTestAssertErrorMessage = String.format(DESCRIPTION_ERROR_FORMAT, empty, assertionError).trim();
private final String testWithoutDescriptionTestExceptionMessage = String.format(DESCRIPTION_ERROR_FORMAT, empty, noSuchElementException).trim();
private final String testDescriptionTestAssertErrorMessage = MarkdownUtils.asTwoParts(TEST_DESCRIPTION, String.format(DESCRIPTION_ERROR_FORMAT, assertionError));
private final String testDescriptionTestExceptionMessage = MarkdownUtils.asTwoParts(TEST_DESCRIPTION, String.format(DESCRIPTION_ERROR_FORMAT, noSuchElementException));
private final String testWithoutDescriptionTestAssertErrorMessage = String.format(DESCRIPTION_ERROR_FORMAT, assertionError).trim();
private final String testWithoutDescriptionTestExceptionMessage = String.format(DESCRIPTION_ERROR_FORMAT, noSuchElementException).trim();

@Mock
private ReportPortalClient client;
Expand Down

0 comments on commit f9788d1

Please sign in to comment.