diff options
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatterTest.java | 18 | ||||
-rw-r--r-- | src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java | 7 |
2 files changed, 22 insertions, 3 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 diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java index 871d0a651..31d0be880 100644 --- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java +++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T 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
@@ -26,7 +28,6 @@ package org.onap.clamp.clds.model.prop; import com.google.gson.JsonObject;
import org.onap.clamp.clds.model.properties.AbstractModelElement;
import org.onap.clamp.clds.model.properties.ModelBpmn;
-import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.JsonUtils;
/**
@@ -40,8 +41,8 @@ public class CustomModelElement extends AbstractModelElement { /**
* Main Constructor.
*/
- public CustomModelElement(ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
- super(CUSTOM_TYPE, modelProp, modelBpmn, modelJson);
+ public CustomModelElement(ModelBpmn modelBpmn, JsonObject modelJson) {
+ super(CUSTOM_TYPE, modelBpmn, modelJson);
topicPublishes = JsonUtils.getStringValueByName(modelElementJsonNode, "topicPublishes");
test = JsonUtils.getStringValueByName(modelElementJsonNode, "test");
}
|