Use system specific file separator
This commit is contained in:
parent
90e584c0f1
commit
b3069d5c4f
1 changed files with 36 additions and 36 deletions
|
@ -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 <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
||||
*/
|
||||
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 <a href=\"https://github.com/ethauvin/semver\">Semantic Version Annotation Processor</a>" + 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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue