1717 */
1818package org .owasp .dependencycheck ;
1919
20- import static org .hamcrest .core .Is .is ;
21- import static org .junit .Assert .assertFalse ;
22- import static org .junit .Assert .assertTrue ;
20+ import org .apache .commons .cli .ParseException ;
21+ import org .apache .commons .cli .UnrecognizedOptionException ;
22+ import org .junit .jupiter .api .Test ;
23+ import org .owasp .dependencycheck .utils .InvalidSettingException ;
24+ import org .owasp .dependencycheck .utils .Settings ;
25+ import org .owasp .dependencycheck .utils .Settings .KEYS ;
2326
2427import java .io .File ;
2528import java .io .FileNotFoundException ;
26- import java .net .URISyntaxException ;
2729import java .util .HashMap ;
2830import java .util .Map ;
2931
30- import org .apache .commons .cli .ParseException ;
31- import org .apache .commons .cli .UnrecognizedOptionException ;
3232import static org .hamcrest .MatcherAssert .assertThat ;
33- import org .junit .Assert ;
34- import org .junit .Test ;
35- import org .owasp .dependencycheck .utils .InvalidSettingException ;
36- import org .owasp .dependencycheck .utils .Settings ;
37- import org .owasp .dependencycheck .utils .Settings .KEYS ;
33+ import static org .hamcrest .core .Is .is ;
34+ import static org .junit .jupiter .api .Assertions .assertFalse ;
35+ import static org .junit .jupiter .api .Assertions .assertThrows ;
36+ import static org .junit .jupiter .api .Assertions .assertTrue ;
3837
3938/**
4039 * Tests for the {@link AppTest} class.
4140 */
42- public class AppTest extends BaseTest {
41+ class AppTest extends BaseTest {
4342
4443 /**
4544 * Test of ensureCanonicalPath method, of class App.
4645 */
4746 @ Test
48- public void testEnsureCanonicalPath () {
47+ void testEnsureCanonicalPath () {
4948 String file = "../*.jar" ;
5049 App instance = new App (getSettings ());
5150 String result = instance .ensureCanonicalPath (file );
@@ -55,7 +54,7 @@ public void testEnsureCanonicalPath() {
5554 file = "../some/skip/../path/file.txt" ;
5655 String expResult = "/some/path/file.txt" ;
5756 result = instance .ensureCanonicalPath (file );
58- assertTrue ("result=" + result , result . endsWith ( expResult ) );
57+ assertTrue (result . endsWith ( expResult ), "result=" + result );
5958 }
6059
6160 /**
@@ -65,7 +64,7 @@ public void testEnsureCanonicalPath() {
6564 * @throws Exception the unexpected {@link Exception}.
6665 */
6766 @ Test
68- public void testPopulateSettings () throws Exception {
67+ void testPopulateSettings () throws Exception {
6968 File prop = new File (this .getClass ().getClassLoader ().getResource ("sample.properties" ).toURI ().getPath ());
7069 String [] args = {"-P" , prop .getAbsolutePath ()};
7170 Map <String , Boolean > expected = new HashMap <>();
@@ -115,13 +114,12 @@ public void testPopulateSettings() throws Exception {
115114 * Assert that an {@link UnrecognizedOptionException} is thrown when a
116115 * property that is not supported is specified on the CLI.
117116 *
118- * @throws Exception the unexpected {@link Exception}.
119117 */
120118 @ Test
121- public void testPopulateSettingsException () throws Exception {
119+ void testPopulateSettingsException () {
122120 String [] args = {"-invalidPROPERTY" };
123- Exception exception = Assert . assertThrows (UnrecognizedOptionException .class , () -> testBooleanProperties (args , null ));
124- Assert . assertTrue (exception .getMessage ().contains ("Unrecognized option: -invalidPROPERTY" ));
121+ Exception exception = assertThrows (UnrecognizedOptionException .class , () -> testBooleanProperties (args , null ));
122+ assertTrue (exception .getMessage ().contains ("Unrecognized option: -invalidPROPERTY" ));
125123 }
126124
127125 /**
@@ -130,7 +128,7 @@ public void testPopulateSettingsException() throws Exception {
130128 * @throws Exception the unexpected {@link Exception}.
131129 */
132130 @ Test
133- public void testPopulatingSuppressionSettingsWithASingleFile () throws Exception {
131+ void testPopulatingSuppressionSettingsWithASingleFile () throws Exception {
134132 // GIVEN CLI properties with the mandatory arguments
135133 File prop = new File (this .getClass ().getClassLoader ().getResource ("sample.properties" ).toURI ().getPath ());
136134
@@ -154,7 +152,7 @@ public void testPopulatingSuppressionSettingsWithASingleFile() throws Exception
154152 * @throws Exception the unexpected {@link Exception}.
155153 */
156154 @ Test
157- public void testPopulatingSuppressionSettingsWithMultipleFiles () throws Exception {
155+ void testPopulatingSuppressionSettingsWithMultipleFiles () throws Exception {
158156 // GIVEN CLI properties with the mandatory arguments
159157 File prop = new File (this .getClass ().getClassLoader ().getResource ("sample.properties" ).toURI ().getPath ());
160158
@@ -172,7 +170,7 @@ public void testPopulatingSuppressionSettingsWithMultipleFiles() throws Exceptio
172170 }
173171
174172
175- private boolean testBooleanProperties (String [] args , Map <String , Boolean > expected ) throws URISyntaxException , FileNotFoundException , ParseException , InvalidSettingException {
173+ private boolean testBooleanProperties (String [] args , Map <String , Boolean > expected ) throws FileNotFoundException , ParseException , InvalidSettingException {
176174 this .reloadSettings ();
177175 final CliParser cli = new CliParser (getSettings ());
178176 cli .parse (args );
0 commit comments