-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
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
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.txt"))) { | ||
for (String line; (line = br.readLine()) != null; ) { | ||
if (line.startsWith("Copyright")) { | ||
copyrightText = line; | ||
break; | ||
} | ||
} | ||
} | ||
String expectedCopyright = String.format("Copyright (c) 2013-%d SendGrid, Inc.", Calendar.getInstance().get(Calendar.YEAR)); | ||
Assert.assertEquals("License has incorrect year", copyrightText, expectedCopyright); | ||
} | ||
} |