summaryrefslogtreecommitdiffstats
path: root/certServiceClient/src/test
diff options
context:
space:
mode:
authorkjaniak <kornel.janiak@nokia.com>2020-02-18 13:25:43 +0100
committerkjaniak <kornel.janiak@nokia.com>2020-02-18 14:48:30 +0100
commit3a1f830126b02e30bcb46de697ae7ff9a3f6b97e (patch)
treeee18f6dea10dae52114e1ad532b39c2bf755285e /certServiceClient/src/test
parent39d5f8d61857e55fd36add1235ca87157b4c9c92 (diff)
Add first test of System.exit
Issue-ID: AAF-996 Signed-off-by: kjaniak <kornel.janiak@nokia.com> Change-Id: Id0ee4d6a08e7050ef080f0e1fadea8c07459571c
Diffstat (limited to 'certServiceClient/src/test')
-rw-r--r--certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientTest.java (renamed from certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java)20
1 files changed, 17 insertions, 3 deletions
diff --git a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientTest.java
index e9d169a0..12c2db06 100644
--- a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java
+++ b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientTest.java
@@ -20,15 +20,29 @@
package org.onap.aaf.certservice.client;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Spy;
+import org.mockito.junit.jupiter.MockitoExtension;
-class CertServiceClientAppTest {
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.verify;
+
+@ExtendWith(MockitoExtension.class)
+class CertServiceClientTest {
+ @Spy
+ CertServiceClient certServiceClient = new CertServiceClient();
// Sonar check for this test disabled due to lack of assertion in test.
// Intention of this test is to check if app runs without exiting Java.
@Test
- public void mainShouldSucceed() { //NOSONAR
+ public void shouldExitWithZero_onApplicationSuccessfulFinish() { //NOSONAR
+ // given
String[] params = {""};
- CertServiceClientApp.main(params);
+ doNothing().when(certServiceClient).exit(0);
+ // when
+ certServiceClient.run(params);
+ // then
+ verify(certServiceClient).exit(0);
}
} \ No newline at end of file