Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a newline before the error message Markdown. #374

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/edu/hm/hafner/grading/AutoGradingRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected String createErrorMessageMarkdown(final FilteredLog log) {
if (log.hasErrors()) {
var errors = new StringBuilder(ERROR_CAPACITY);

errors.append("## :construction: Error Messages\n```\n");
errors.append("\n## :construction: Error Messages\n```\n");
var messages = new StringJoiner("\n");
log.getErrorMessages().forEach(messages::add);
errors.append(messages);
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/edu/hm/hafner/grading/AutoGradingRunnerITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,17 @@ void shouldShowErrors() {
"Autograding score - 200 of 500"});
}

@Test
void shouldShowNewlineBeforeErrorMessage() {
var runner = new AutoGradingRunner();
var log = new FilteredLog("Errors");
log.logError("This is an error");
assertThat(runner.createErrorMessageMarkdown(log))
.startsWith("\n")
.contains("## :construction: Error Messages")
.contains("This is an error");
}

@Test
void shouldReadDefaultConfigurationIfEnvironmentIsNotSet() {
var runner = new AutoGradingRunner();
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.