aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorXue Gao <xg353y@intl.att.com>2019-04-19 07:49:10 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-19 07:49:10 +0000
commit8a5f261afe749fa7d1e225de0b312248f433a902 (patch)
tree1cfca00f46966f8ffa4db35efdac71e456ac035b /src/test/java
parent1fa0d15336844fd236a6a215978dc1c0f6f1a1f1 (diff)
parent2a7aea69978e03a69457e80f5b4778842f08ee3e (diff)
Merge "Improve test coverage in TcaRequestFormatter"
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java b/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
index 095df9d84..c92cdcf35 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2019 Nokia Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -31,7 +33,9 @@ import static org.mockito.Mockito.when;
import com.google.gson.JsonObject;
import java.io.IOException;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.exception.TcaRequestFormatterException;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.model.properties.Tca;
import org.onap.clamp.clds.model.properties.TcaItem;
@@ -95,4 +99,18 @@ public class TcaRequestFormatterTest {
//then
assertThat(expectedRequest).isEqualTo(policyContent);
}
+
+ @Test(expected = TcaRequestFormatterException.class)
+ public void shouldThrowTcaRequestFormatterException() throws IOException{
+ //given
+ String service = "TestService";
+ String policy = "TestService_scope.PolicyName";
+ ClampProperties clampProperties = mock(ClampProperties.class);
+ ModelProperties modelProperties = mock(ModelProperties.class);
+ Tca tca = mock(Tca.class);
+ //when
+ Mockito.when(clampProperties.getJsonTemplate(any(), any())).thenThrow(IOException.class);
+ //then
+ TcaRequestFormatter.createPolicyContent(clampProperties, modelProperties, service, policy, tca);
+ }
} \ No newline at end of file