@@ -268,7 +268,18 @@ void should_preserve_year_for_license_with_address() throws Throwable {
268268 void should_apply_license_containing_filename_token () throws Exception {
269269 FormatterStep step = LicenseHeaderStep .headerDelimiter (header (HEADER_WITH_$FILE ), package_ ).build ();
270270 StepHarnessWithFile .forStep (this , step )
271- .test (new File ("Test.java" ), getTestResource (FILE_NO_LICENSE ), hasHeaderFileName (HEADER_WITH_$FILE , "Test.java" ));
271+ .test (new File ("Test.java" ), getTestResource (FILE_NO_LICENSE ), hasHeaderFileName (HEADER_WITH_$FILE , "Test.java" ))
272+ .testUnaffected (new File ("Test.java" ), hasHeaderFileName (HEADER_WITH_$FILE , "Test.java" ));
273+ }
274+
275+ @ Test
276+ void should_update_license_containing_filename_token () throws Exception {
277+ FormatterStep step = LicenseHeaderStep .headerDelimiter (header (HEADER_WITH_$FILE ), package_ ).build ();
278+ StepHarnessWithFile .forStep (this , step )
279+ .test (
280+ new File ("After.java" ),
281+ hasHeaderFileName (HEADER_WITH_$FILE , "Before.java" ),
282+ hasHeaderFileName (HEADER_WITH_$FILE , "After.java" ));
272283 }
273284
274285 @ Test
@@ -278,6 +289,9 @@ void should_apply_license_containing_YEAR_filename_token() throws Exception {
278289 .test (
279290 new File ("Test.java" ),
280291 getTestResource (FILE_NO_LICENSE ),
292+ hasHeaderYearFileName (HEADER_WITH_$YEAR_$FILE , currentYear (), "Test.java" ))
293+ .testUnaffected (
294+ new File ("Test.java" ),
281295 hasHeaderYearFileName (HEADER_WITH_$YEAR_$FILE , currentYear (), "Test.java" ));
282296 }
283297}
0 commit comments