Skip to content

Commit

Permalink
Merge pull request #66 from pushkyn/test-release-date-range
Browse files Browse the repository at this point in the history
Test to check year in license file
  • Loading branch information
Matt Bernier authored Oct 31, 2017
2 parents 4a4e5bd + 11a1776 commit 39ee7b5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/java/com/sendgrid/LicenseTest.java
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);
}
}

0 comments on commit 39ee7b5

Please sign in to comment.