From b3069d5c4f1f3bbcb3c69deae9e5afb42b51e736 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 26 Mar 2025 14:48:58 -0700 Subject: [PATCH] Use system specific file separator --- .../erik/semver/VersionProcessorTest.java | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/test/java/net/thauvin/erik/semver/VersionProcessorTest.java b/src/test/java/net/thauvin/erik/semver/VersionProcessorTest.java index 97622d8..72f2ef8 100644 --- a/src/test/java/net/thauvin/erik/semver/VersionProcessorTest.java +++ b/src/test/java/net/thauvin/erik/semver/VersionProcessorTest.java @@ -67,44 +67,44 @@ class VersionProcessorTest { assertEquals(Constants.DEFAULT_JAVA_TEMPLATE, mustache.getName(), Constants.DEFAULT_JAVA_TEMPLATE); + var eol = System.lineSeparator(); + try (var writer = new StringWriter()) { mustache.execute(writer, version).flush(); - assertEquals(String.format(""" - /* - * This file is automatically generated. - * Do not modify! -- ALL CHANGES WILL BE ERASED! - */ - - package %s; - - import java.util.Date; - - /** - * Provides semantic version information. - * - * @author Semantic Version Annotation Processor - */ - public final class %s { - public static final String PROJECT = "%s"; - public static final Date BUILDDATE = new Date(L); - public static final int MAJOR = %d; - public static final int MINOR = %d; - public static final int PATCH = %d; - public static final String PRERELEASE = "%s"; - public static final String PRERELEASE_PREFIX = "%s"; - public static final String BUILDMETA = "%s"; - public static final String BUILDMETA_PREFIX = "%s"; - public static final String SEPARATOR = "%s"; - public static final String VERSION = ""; - - /** - * Disables the default constructor. - */ - private %s() { - throw new UnsupportedOperationException("Illegal constructor call."); - } - } - """, version.packageName(), version.className(), version.project(), version.major(), + assertEquals(String.format("/*" + eol + + " * This file is automatically generated." + eol + + " * Do not modify! -- ALL CHANGES WILL BE ERASED!" + eol + + " */" + eol + + eol + + "package %s;" + eol + + eol + + "import java.util.Date;" + eol + + eol + + "/**" + eol + + " * Provides semantic version information." + eol + + " *" + eol + + " * @author Semantic Version Annotation Processor" + eol + + " */" + eol + + "public final class %s {" + eol + + " public static final String PROJECT = \"%s\";" + eol + + " public static final Date BUILDDATE = new Date(L);" + eol + + " public static final int MAJOR = %d;" + eol + + " public static final int MINOR = %d;" + eol + + " public static final int PATCH = %d;" + eol + + " public static final String PRERELEASE = \"%s\";" + eol + + " public static final String PRERELEASE_PREFIX = \"%s\";" + eol + + " public static final String BUILDMETA = \"%s\";" + eol + + " public static final String BUILDMETA_PREFIX = \"%s\";" + eol + + " public static final String SEPARATOR = \"%s\";" + eol + + " public static final String VERSION = \"\";" + eol + + eol + + " /**" + eol + + " * Disables the default constructor." + eol + + " */" + eol + + " private %s() {" + eol + + " throw new UnsupportedOperationException(\"Illegal constructor call.\");" + eol + + " }" + eol + + "}" + eol, version.packageName(), version.className(), version.project(), version.major(), version.minor(), version.patch(), version.preRelease(), version.preReleasePrefix(), version.buildMeta(), version.buildMetaPrefix(), version.separator(), version.className()), writer.toString());