Skip to content

Commit

Permalink
Run tests with correct locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Apr 10, 2024
1 parent 24b2345 commit d10026e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/edu/hm/hafner/grading/TestMarkdown.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected String createSummary(final TestScore score) {
.append(getTitle(score, 0));
if (score.hasFailures() || score.hasPassedTests() || score.hasSkippedTests()) {
summary.append(": ").append(
"%.2f %% successful".formatted(score.getPassedSize() * 100.0 / score.getTotalSize()));
"%2d %% successful".formatted(Math.round(score.getPassedSize() * 100.0 / score.getTotalSize())));
var joiner = new StringJoiner(", ", " (", ")");
if (score.hasFailures()) {
joiner.add(":x: %d failed".formatted(score.getFailedSize()));
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/edu/hm/hafner/grading/GradingReportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.NoSuchElementException;

import org.junit.jupiter.api.Test;
import org.junitpioneer.jupiter.DefaultLocale;

import edu.hm.hafner.util.FilteredLog;

Expand All @@ -14,6 +15,7 @@
*
* @author Ullrich Hafner
*/
@DefaultLocale("en")
class GradingReportTest {
private static final String NO_SCORE_CONFIGURATION = """
{
Expand Down Expand Up @@ -108,7 +110,7 @@ void shouldCreateAllGradingResults() {
"img title=\"Score percentage: 33%\"",
"percentages/033.svg",
"# :mortar_board:   Summary - 167 of 500",
"JUnit - 77 of 100", "22,73 % successful", "14 failed", "5 passed", "3 skipped",
"JUnit - 77 of 100", "23 % successful", "14 failed", "5 passed", "3 skipped",
"Line Coverage - 60 of 100", "80% (20 missed lines)",
"Branch Coverage - 20 of 100", "60% (40 missed branches)",
"Mutation Coverage - 20 of 100: 60% (40 survived mutations)",
Expand Down Expand Up @@ -136,7 +138,7 @@ void shouldCreateAllQualityResults() {

var score = AggregatedScoreTest.createQualityAggregation();
assertThat(results.getMarkdownSummary(score, "Summary")).contains(
"JUnit: 22,73 % successful ", "14 failed", "5 passed", "3 skipped",
"JUnit: 23 % successful ", "14 failed", "5 passed", "3 skipped",
"Line Coverage: 80% (20 missed lines)",
"Branch Coverage: 60% (40 missed branches)",
"Mutation Coverage: 60% (40 survived mutations)",
Expand Down Expand Up @@ -223,7 +225,7 @@ void shouldSkipScores() {

assertThat(results.getMarkdownSummary(aggregation, "Summary")).contains(
"### :sunny:   Summary",
"JUnit: 22,73 % successful (:x: 14 failed, :heavy_check_mark: 5 passed, :see_no_evil: 3 skipped)",
"JUnit: 23 % successful (:x: 14 failed, :heavy_check_mark: 5 passed, :see_no_evil: 3 skipped)",
"Line Coverage: 80% (20 missed lines)",
"Branch Coverage: 60% (40 missed branches)",
"Mutation Coverage: 60% (40 survived mutations)",
Expand Down

0 comments on commit d10026e

Please sign in to comment.