aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/job
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-07-18 11:41:19 +0300
committerIttay Stern <ittay.stern@att.com>2019-07-18 11:06:53 +0000
commit3bf5f113cd4dfefdbc27f01fd7ec7c5e39d48695 (patch)
tree052eadd96caf9c84722ddb1952ff0fb807cc307f /vid-app-common/src/test/java/org/onap/vid/job
parent0f54454a7f6a26b42aa78c228d63a74f9a619a78 (diff)
Don't override SystemProperties without restoring it
This resolves NullPointerException in Dublin's Jenkins' SyncRestClientForHttpServerTest. Issue-ID: VID-503 (cherry picked from commit ef34f16650be1f251447a7b9a1d9f1369ca459de) Change-Id: I65fbed0a6f6214d9495d0cb6456b3a8e4f094a3d Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/job')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
index 527ba17ad..31dbc9f6d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
@@ -58,6 +58,7 @@ import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
import static org.onap.vid.job.Job.JobStatus.*;
+import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty;
public class ServiceInProgressStatusCommandTest {
@@ -218,11 +219,9 @@ public class ServiceInProgressStatusCommandTest {
}
@Test(dataProvider = "isExpiredJobStatusData")
- public void isExpiredJobStatusTest(ZonedDateTime jobStartTime, String configValue, boolean expectedResult) {
- SystemProperties systemProperties = new SystemProperties();
- systemProperties.setEnvironment(environment);
- when(environment.getRequiredProperty(VidProperties.VID_JOB_MAX_HOURS_IN_PROGRESS)).thenReturn(configValue);
- when(environment.containsProperty(VidProperties.VID_JOB_MAX_HOURS_IN_PROGRESS)).thenReturn(true);
- Assert.assertEquals(command.getExpiryChecker().isExpired(jobStartTime), expectedResult);
+ public void isExpiredJobStatusTest(ZonedDateTime jobStartTime, String configValue, boolean expectedResult) throws Exception {
+ testWithSystemProperty(VidProperties.VID_JOB_MAX_HOURS_IN_PROGRESS, configValue, ()->
+ Assert.assertEquals(command.getExpiryChecker().isExpired(jobStartTime), expectedResult)
+ );
}
}