Improved Javadoc and added test for isPage method.

This commit is contained in:
Christian P. MOMON 2024-09-23 03:16:33 +02:00
parent 35a90e3ff9
commit c330ac064d
2 changed files with 36 additions and 1 deletions

View file

@ -307,7 +307,21 @@ public class HttpAccessLogAnalyzer
/** /**
* Checks if is page. * Checks if is page.
* *
* <pre>
* null => false
* "" => false
* " " => false
* "GET /foo" => true
* "GET /foo42" => true
* "GET /foo.cgi" => true
* "GET /foo.htm" => true
* "GET /foo.html" => true
* "GET /foo.php" => true
* "GET /foo.xhtml" => true
* "GET /foo.jpg" => false
* </pre>
*
* @param request * @param request
* the request * the request
* @return true, if is page * @return true, if is page

View file

@ -38,6 +38,27 @@ import fr.devinsy.statoolinfos.util.FilesUtils;
*/ */
public class HttpAccessLogsAnalyzerTest public class HttpAccessLogsAnalyzerTest
{ {
/**
* Checks if is page test 01.
*/
@Test
public void isPageTest01()
{
Assert.assertFalse(HttpAccessLogAnalyzer.isPage(null));
Assert.assertFalse(HttpAccessLogAnalyzer.isPage(""));
Assert.assertFalse(HttpAccessLogAnalyzer.isPage(" "));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo42"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.html"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HTML"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HtMl"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo.HtMl"));
Assert.assertTrue(HttpAccessLogAnalyzer.isPage("GET /foo/bar/foo.php"));
Assert.assertFalse(HttpAccessLogAnalyzer.isPage("GET /foo.jpg"));
}
/** /**
* @throws Exception * @throws Exception
*/ */