-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathLicenseTest.java
More file actions
27 lines (23 loc) · 901 Bytes
/
LicenseTest.java
File metadata and controls
27 lines (23 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"))) {
for (String line; (line = br.readLine()) != null; ) {
if (line.startsWith("Copyright")) {
copyrightText = line;
break;
}
}
}
String expectedCopyright = String.format("Copyright (C) %d, Twilio SendGrid, Inc. <help@twilio.com>", Calendar.getInstance().get(Calendar.YEAR));
Assert.assertEquals("License has incorrect year", copyrightText, expectedCopyright);
}
}