diff options
Diffstat (limited to 'aai-core/src/test/java/org/onap/aai/util/AAIConfigCommandLinePropGetterTest.java')
-rw-r--r-- | aai-core/src/test/java/org/onap/aai/util/AAIConfigCommandLinePropGetterTest.java | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/aai-core/src/test/java/org/onap/aai/util/AAIConfigCommandLinePropGetterTest.java b/aai-core/src/test/java/org/onap/aai/util/AAIConfigCommandLinePropGetterTest.java index 316cc150..c64c9a93 100644 --- a/aai-core/src/test/java/org/onap/aai/util/AAIConfigCommandLinePropGetterTest.java +++ b/aai-core/src/test/java/org/onap/aai/util/AAIConfigCommandLinePropGetterTest.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.util; import static org.junit.Assert.assertEquals; @@ -30,74 +31,73 @@ import org.onap.aai.AAISetup; public class AAIConfigCommandLinePropGetterTest extends AAISetup { - private SecurityManager m; - private TestSecurityManager sm; + private SecurityManager m; + private TestSecurityManager sm; + + @Before + public void setUp() { + m = System.getSecurityManager(); + sm = new TestSecurityManager(); + System.setSecurityManager(sm); + } + + @After + public void tearDown() { + System.setSecurityManager(m); + } - @Before - public void setUp() - { - m = System.getSecurityManager(); - sm = new TestSecurityManager(); - System.setSecurityManager(sm); - } + @Test + public void testMainNoArgs() { + try { + AAIConfigCommandLinePropGetter.main(new String[] {}); + } catch (SecurityException se) { + // assert main method ends with System.exit(0) + assertEquals("0", se.getMessage()); + } + } - @After - public void tearDown() - { - System.setSecurityManager(m); - } + @Test + public void testMainReadProp() { + try { + AAIConfigCommandLinePropGetter.main(new String[] {"aai.primary.filetransfer.serverlist"}); + } catch (SecurityException se) { + // assert main method ends with System.exit(0) + assertEquals("0", se.getMessage()); + } + } - @Test - public void testMainNoArgs() { - try { - AAIConfigCommandLinePropGetter.main(new String[] {}); - } catch (SecurityException se) { - // assert main method ends with System.exit(0) - assertEquals("0", se.getMessage()); - } - } - - @Test - public void testMainReadProp() { - try { - AAIConfigCommandLinePropGetter.main(new String[] {"aai.primary.filetransfer.serverlist"}); - } catch (SecurityException se) { - // assert main method ends with System.exit(0) - assertEquals("0", se.getMessage()); - } - } - - @Test - public void testMainOneArg() { - try { - AAIConfigCommandLinePropGetter.main(new String[] {"one"}); - } catch (SecurityException se) { - // assert main method ends with System.exit(0) - assertEquals("0", se.getMessage()); - } - } - - @Test - public void testMainMoreThanOneArg() { - try { - AAIConfigCommandLinePropGetter.main(new String[] {"one", "two"}); - } catch (SecurityException se) { - // assert main method ends with System.exit(0) - assertEquals("0", se.getMessage()); - } - } + @Test + public void testMainOneArg() { + try { + AAIConfigCommandLinePropGetter.main(new String[] {"one"}); + } catch (SecurityException se) { + // assert main method ends with System.exit(0) + assertEquals("0", se.getMessage()); + } + } + + @Test + public void testMainMoreThanOneArg() { + try { + AAIConfigCommandLinePropGetter.main(new String[] {"one", "two"}); + } catch (SecurityException se) { + // assert main method ends with System.exit(0) + assertEquals("0", se.getMessage()); + } + } } + class TestSecurityManager extends SecurityManager { - @Override - public void checkPermission(Permission permission) { - if ("exitVM".equals(permission.getName())) - { - throw new SecurityException("System.exit attempted and blocked."); - } - } - @Override - public void checkExit(int status) { - throw new SecurityException(Integer.toString(status)); - } + @Override + public void checkPermission(Permission permission) { + if ("exitVM".equals(permission.getName())) { + throw new SecurityException("System.exit attempted and blocked."); + } + } + + @Override + public void checkExit(int status) { + throw new SecurityException(Integer.toString(status)); + } } |