-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from pushkyn/test-release-date-range
Test to check year in license file
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.sendgrid; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.util.Calendar; | ||
|
||
public class LicenseTest { | ||
|
||
@Test | ||
public void testLicenseShouldHaveCorrectYear() throws IOException { | ||
String copyrightText = null; | ||
try (BufferedReader br = new BufferedReader(new FileReader("./LICENSE.md"))) { | ||
for (String line; (line = br.readLine()) != null; ) { | ||
if (line.startsWith("Copyright")) { | ||
copyrightText = line; | ||
break; | ||
} | ||
} | ||
} | ||
String expectedCopyright = String.format("Copyright (c) 2016-%d SendGrid, Inc.", Calendar.getInstance().get(Calendar.YEAR)); | ||
Assert.assertEquals("License has incorrect year", copyrightText, expectedCopyright); | ||
} | ||
} |