MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / licenseYear

Method licenseYear

src/test/java/org/htmlunit/CodeStyleTest.java:362–377  ·  view source on GitHub ↗

Checks the year in LICENSE.txt.

()

Source from the content-addressed store, hash-verified

360 * Checks the year in {@code LICENSE.txt}.
361 */
362 private void licenseYear() throws IOException {
363 final List<String> lines = FileUtils.readLines(new File("checkstyle.xml"), SOURCE_ENCODING);
364 boolean check = false;
365 final String copyright = "Copyright (c) 2002-" + LocalDate.now().getYear();
366 for (final String line : lines) {
367 if (line.contains("<property name=\"header\"")) {
368 if (!line.contains(copyright)) {
369 addFailure("checkstyle.xml", 0, "Incorrect year in checkstyle.xml");
370 }
371 check = true;
372 }
373 }
374 if (!check) {
375 addFailure("checkstyle.xml", 0, "No \"header\" found");
376 }
377 }
378
379 /**
380 * Checks the year in the {@link Version}.

Callers 1

codeStyleMethod · 0.95

Calls 4

addFailureMethod · 0.95
getYearMethod · 0.80
containsMethod · 0.65
nowMethod · 0.45

Tested by

no test coverage detected