doclint fixes

This commit is contained in:
Jeremy Long
2016-03-05 13:18:34 -05:00
parent 8022381d1c
commit 76bcbb5a7e

View File

@@ -30,147 +30,137 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Unit tests for AutoconfAnalyzer. The test resources under autoconf/ were
* obtained from outside open source software projects. Links to those projects
* are given below.
* Unit tests for AutoconfAnalyzer. The test resources under autoconf/ were obtained from outside open source software projects.
* Links to those projects are given below.
*
* @author Dale Visser <dvisser@ida.org>
* @see <a href="http://readable.sourceforge.net/">Readable Lisp S-expressions
* Project</a>
* @author Dale Visser
* @see <a href="http://readable.sourceforge.net/">Readable Lisp S-expressions Project</a>
* @see <a href="https://gnu.org/software/binutils/">GNU Binutils</a>
* @see <a href="https://gnu.org/software/ghostscript/">GNU Ghostscript</a>
*/
public class AutoconfAnalyzerTest extends BaseTest {
/**
* The analyzer to test.
*/
AutoconfAnalyzer analyzer;
/**
* The analyzer to test.
*/
AutoconfAnalyzer analyzer;
private void assertCommonEvidence(Dependency result, String product,
String version, String vendor) {
assertProductAndVersion(result, product, version);
assertTrue("Expected vendor evidence to contain \"" + vendor + "\".",
result.getVendorEvidence().toString().contains(vendor));
}
private void assertCommonEvidence(Dependency result, String product,
String version, String vendor) {
assertProductAndVersion(result, product, version);
assertTrue("Expected vendor evidence to contain \"" + vendor + "\".",
result.getVendorEvidence().toString().contains(vendor));
}
private void assertProductAndVersion(Dependency result, String product,
String version) {
assertTrue("Expected product evidence to contain \"" + product + "\".",
result.getProductEvidence().toString().contains(product));
assertTrue("Expected version evidence to contain \"" + version + "\".",
result.getVersionEvidence().toString().contains(version));
}
private void assertProductAndVersion(Dependency result, String product,
String version) {
assertTrue("Expected product evidence to contain \"" + product + "\".",
result.getProductEvidence().toString().contains(product));
assertTrue("Expected version evidence to contain \"" + version + "\".",
result.getVersionEvidence().toString().contains(version));
}
/**
* Correctly setup the analyzer for testing.
*
* @throws Exception
* thrown if there is a problem
*/
@Before
public void setUp() throws Exception {
analyzer = new AutoconfAnalyzer();
analyzer.setFilesMatched(true);
analyzer.initialize();
}
/**
* Correctly setup the analyzer for testing.
*
* @throws Exception thrown if there is a problem
*/
@Before
public void setUp() throws Exception {
analyzer = new AutoconfAnalyzer();
analyzer.setFilesMatched(true);
analyzer.initialize();
}
/**
* Cleanup the analyzer's temp files, etc.
*
* @throws Exception
* thrown if there is a problem
*/
@After
public void tearDown() throws Exception {
analyzer.close();
analyzer = null;
}
/**
* Cleanup the analyzer's temp files, etc.
*
* @throws Exception thrown if there is a problem
*/
@After
public void tearDown() throws Exception {
analyzer.close();
analyzer = null;
}
/**
* Test whether expected evidence is gathered from Ghostscript's
* configure.ac.
*
* @throws AnalysisException
* is thrown when an exception occurs.
*/
@Test
public void testAnalyzeConfigureAC1() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/ghostscript/configure.ac"));
analyzer.analyze(result, null);
assertCommonEvidence(result, "ghostscript", "8.62.0", "gnu");
}
/**
* Test whether expected evidence is gathered from Ghostscript's configure.ac.
*
* @throws AnalysisException is thrown when an exception occurs.
*/
@Test
public void testAnalyzeConfigureAC1() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/ghostscript/configure.ac"));
analyzer.analyze(result, null);
assertCommonEvidence(result, "ghostscript", "8.62.0", "gnu");
}
/**
* Test whether expected evidence is gathered from Readable's configure.ac.
*
* @throws AnalysisException
* is thrown when an exception occurs.
*/
@Test
public void testAnalyzeConfigureAC2() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/readable-code/configure.ac"));
analyzer.analyze(result, null);
assertReadableCodeEvidence(result);
}
/**
* Test whether expected evidence is gathered from Readable's configure.ac.
*
* @throws AnalysisException is thrown when an exception occurs.
*/
@Test
public void testAnalyzeConfigureAC2() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/readable-code/configure.ac"));
analyzer.analyze(result, null);
assertReadableCodeEvidence(result);
}
private void assertReadableCodeEvidence(final Dependency result) {
assertCommonEvidence(result, "readable", "1.0.7", "dwheeler");
final String url = "http://readable.sourceforge.net/";
assertTrue("Expected product evidence to contain \"" + url + "\".",
result.getVendorEvidence().toString().contains(url));
}
private void assertReadableCodeEvidence(final Dependency result) {
assertCommonEvidence(result, "readable", "1.0.7", "dwheeler");
final String url = "http://readable.sourceforge.net/";
assertTrue("Expected product evidence to contain \"" + url + "\".",
result.getVendorEvidence().toString().contains(url));
}
/**
* Test whether expected evidence is gathered from GNU Binutil's configure.
*
* @throws AnalysisException
* is thrown when an exception occurs.
*/
@Test
public void testAnalyzeConfigureScript() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/binutils/configure"));
analyzer.analyze(result, null);
assertProductAndVersion(result, "binutils", "2.25.51");
}
/**
* Test whether expected evidence is gathered from GNU Binutil's configure.
*
* @throws AnalysisException is thrown when an exception occurs.
*/
@Test
public void testAnalyzeConfigureScript() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/binutils/configure"));
analyzer.analyze(result, null);
assertProductAndVersion(result, "binutils", "2.25.51");
}
/**
* Test whether expected evidence is gathered from GNU Ghostscript's
* configure.
*
* @throws AnalysisException
* is thrown when an exception occurs.
*/
@Test
public void testAnalyzeReadableConfigureScript() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/readable-code/configure"));
analyzer.analyze(result, null);
assertReadableCodeEvidence(result);
}
/**
* Test whether expected evidence is gathered from GNU Ghostscript's configure.
*
* @throws AnalysisException is thrown when an exception occurs.
*/
@Test
public void testAnalyzeReadableConfigureScript() throws AnalysisException {
final Dependency result = new Dependency(BaseTest.getResourceAsFile(
this, "autoconf/readable-code/configure"));
analyzer.analyze(result, null);
assertReadableCodeEvidence(result);
}
/**
* Test of getName method, of {@link AutoconfAnalyzer}.
*/
@Test
public void testGetName() {
assertEquals("Analyzer name wrong.", "Autoconf Analyzer",
analyzer.getName());
}
/**
* Test of getName method, of {@link AutoconfAnalyzer}.
*/
@Test
public void testGetName() {
assertEquals("Analyzer name wrong.", "Autoconf Analyzer",
analyzer.getName());
}
/**
* Test of {@link AutoconfAnalyzer#accept(File)}.
*/
@Test
public void testSupportsFileExtension() {
assertTrue("Should support \"ac\" extension.",
analyzer.accept(new File("configure.ac")));
assertTrue("Should support \"in\" extension.",
analyzer.accept(new File("configure.in")));
assertTrue("Should support \"configure\" extension.",
analyzer.accept(new File("configure")));
}
}
/**
* Test of {@link AutoconfAnalyzer#accept(File)}.
*/
@Test
public void testSupportsFileExtension() {
assertTrue("Should support \"ac\" extension.",
analyzer.accept(new File("configure.ac")));
assertTrue("Should support \"in\" extension.",
analyzer.accept(new File("configure.in")));
assertTrue("Should support \"configure\" extension.",
analyzer.accept(new File("configure")));
}
}