@@ -0,0 +1,2407 @@
+/*%0A * Copyright 2020 DiffPlug%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.diffplug.spotless.maven.generic;%0A%0Aimport java.io.IOException;%0Aimport java.time.YearMonth;%0A%0Aimport org.eclipse.jgit.api.Git;%0Aimport org.junit.Test;%0A%0Aimport com.diffplug.spotless.maven.MavenIntegrationHarness;%0A%0Apublic class LicenseHeaderRatchetTest extends MavenIntegrationHarness %7B%0A%09private static final String NOW = String.valueOf(YearMonth.now().getYear());%0A%0A%09private static final String TEST_JAVA = %22src/main/java/pkg/Test.java%22;%0A%09private static final String CONTENT = %22package pkg;%5Cnpublic class Test %7B%7D%22;%0A%0A%09private void setRatchetFrom(String ratchetFrom) throws IOException %7B%0A%09%09writePomWithJavaSteps(%0A%09%09%09%09%22%3ClicenseHeader%3E%22,%0A%09%09%09%09%22  %3Ccontent%3E/** $YEAR */%3C/content%3E%22,%0A%09%09%09%09%22%3C/licenseHeader%3E%22,%0A%09%09%09%09ratchetFrom);%0A%09%7D%0A%0A%09private void assertUnchanged(String year) throws Exception %7B%0A%09%09assertTransform(year, year);%0A%09%7D%0A%0A%09private void assertTransform(String yearBefore, String yearAfter) throws Exception %7B%0A%09%09setFile(TEST_JAVA).toContent(%22/** %22 + yearBefore + %22 */%5Cn%22 + CONTENT);%0A%09%09mavenRunner().withArguments(%22spotless:apply%22).runNoError();%0A%09%09assertFile(TEST_JAVA).hasContent(%22/** %22 + yearAfter + %22 */%5Cn%22 + CONTENT);%0A%09%7D%0A%0A%09private void testSuiteUpdateWithLatest(boolean update) throws Exception %7B%0A%09%09if (update) %7B%0A%09%09%09assertTransform(%222003%22, %222003-%22 + NOW);%0A%09%09%09assertTransform(%222003-2005%22, %222003-%22 + NOW);%0A%09%09%7D else %7B%0A%09%09%09assertUnchanged(%222003%22);%0A%09%09%09assertUnchanged(%222003-2005%22);%0A%09%09%7D%0A%09%09assertUnchanged(NOW);%0A%09%09assertTransform(%22%22, NOW);%0A%09%7D%0A%0A%09@Test%0A%09public void normal() throws Exception %7B%0A%09%09setRatchetFrom(%22%22);%0A%09%09testSuiteUpdateWithLatest(false);%0A%09%7D%0A%0A%09@Test%0A%09public void ratchetFrom() throws Exception %7B%0A%09%09try (Git git = Git.init().setDirectory(rootFolder()).call()) %7B%0A%09%09%09git.commit().setMessage(%22First commit%22).call();%0A%09%09%7D%0A%09%09setRatchetFrom(%22%3CratchetFrom%3EHEAD%3C/ratchetFrom%3E%22);%0A%09%09testSuiteUpdateWithLatest(true);%0A%09%7D%0A%7D%0A

Add a test for the license header reatchet behavior in the maven plugin.