Use system specific file separator

This commit is contained in:
Erik C. Thauvin 2025-03-26 14:48:58 -07:00
parent 90e584c0f1
commit b3069d5c4f
Signed by: erik
GPG key ID: 776702A6A2DA330E

View file

@ -67,44 +67,44 @@ class VersionProcessorTest {
assertEquals(Constants.DEFAULT_JAVA_TEMPLATE, mustache.getName(), Constants.DEFAULT_JAVA_TEMPLATE); assertEquals(Constants.DEFAULT_JAVA_TEMPLATE, mustache.getName(), Constants.DEFAULT_JAVA_TEMPLATE);
var eol = System.lineSeparator();
try (var writer = new StringWriter()) { try (var writer = new StringWriter()) {
mustache.execute(writer, version).flush(); mustache.execute(writer, version).flush();
assertEquals(String.format(""" assertEquals(String.format("/*" + eol +
/* " * This file is automatically generated." + eol +
* This file is automatically generated. " * Do not modify! -- ALL CHANGES WILL BE ERASED!" + eol +
* Do not modify! -- ALL CHANGES WILL BE ERASED! " */" + eol +
*/ eol +
"package %s;" + eol +
package %s; eol +
"import java.util.Date;" + eol +
import java.util.Date; eol +
"/**" + eol +
/** " * Provides semantic version information." + eol +
* Provides semantic version information. " *" + eol +
* " * @author <a href=\"https://github.com/ethauvin/semver\">Semantic Version Annotation Processor</a>" + eol +
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a> " */" + eol +
*/ "public final class %s {" + eol +
public final class %s { " public static final String PROJECT = \"%s\";" + eol +
public static final String PROJECT = "%s"; " public static final Date BUILDDATE = new Date(L);" + eol +
public static final Date BUILDDATE = new Date(L); " public static final int MAJOR = %d;" + eol +
public static final int MAJOR = %d; " public static final int MINOR = %d;" + eol +
public static final int MINOR = %d; " public static final int PATCH = %d;" + eol +
public static final int PATCH = %d; " public static final String PRERELEASE = \"%s\";" + eol +
public static final String PRERELEASE = "%s"; " public static final String PRERELEASE_PREFIX = \"%s\";" + eol +
public static final String PRERELEASE_PREFIX = "%s"; " public static final String BUILDMETA = \"%s\";" + eol +
public static final String BUILDMETA = "%s"; " public static final String BUILDMETA_PREFIX = \"%s\";" + eol +
public static final String BUILDMETA_PREFIX = "%s"; " public static final String SEPARATOR = \"%s\";" + eol +
public static final String SEPARATOR = "%s"; " public static final String VERSION = \"\";" + eol +
public static final String VERSION = ""; eol +
" /**" + eol +
/** " * Disables the default constructor." + eol +
* Disables the default constructor. " */" + eol +
*/ " private %s() {" + eol +
private %s() { " throw new UnsupportedOperationException(\"Illegal constructor call.\");" + eol +
throw new UnsupportedOperationException("Illegal constructor call."); " }" + eol +
} "}" + eol, version.packageName(), version.className(), version.project(), version.major(),
}
""", version.packageName(), version.className(), version.project(), version.major(),
version.minor(), version.patch(), version.preRelease(), version.preReleasePrefix(), version.minor(), version.patch(), version.preRelease(), version.preReleasePrefix(),
version.buildMeta(), version.buildMetaPrefix(), version.separator(), version.className()), version.buildMeta(), version.buildMetaPrefix(), version.separator(), version.className()),
writer.toString()); writer.toString());