2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.test;
23 import java.util.UUID;
26 import org.onap.policy.api.DeletePolicyCondition;
27 import org.onap.policy.api.DeletePolicyParameters;
29 import static org.junit.Assert.*;
32 * The class <code>DeletePolicyParametersTest</code> contains tests for the
33 * class <code>{@link DeletePolicyParameters}</code>.
35 * @generatedBy CodePro at 6/1/16 1:40 PM
36 * @version $Revision: 1.0 $
38 public class DeletePolicyParametersTest {
39 private static final String POLICY_TYPE = "POLICYTYPE";
41 private static final String PDP_GROUP = "PDPGROUP";
43 private static final String POLICY_NAME = "Apex";
45 private static final String POLICY_COMPONENT = "ApexComponent";
48 * Run the DeletePolicyCondition getDeleteCondition() method test.
52 * @generatedBy CodePro at 6/1/16 1:40 PM
55 public void testGetDeleteCondition_1() throws Exception {
56 final DeletePolicyParameters fixture = new DeletePolicyParameters();
57 fixture.setPolicyComponent("");
58 fixture.setPolicyName("");
59 fixture.setDeleteCondition(DeletePolicyCondition.ALL);
60 fixture.setRequestID(UUID.randomUUID());
61 fixture.setPdpGroup("");
63 final DeletePolicyCondition result = fixture.getDeleteCondition();
65 // add additional test code here
66 assertNotNull(result);
67 assertEquals("All Versions", result.toString());
68 assertEquals("ALL", result.name());
69 assertEquals(1, result.ordinal());
73 * Run the String getPdpGroup() method test.
77 * @generatedBy CodePro at 6/1/16 1:40 PM
80 public void testGetPdpGroup_1() throws Exception {
81 final DeletePolicyParameters fixture = new DeletePolicyParameters();
82 fixture.setPolicyComponent("");
83 fixture.setPolicyName("");
84 fixture.setDeleteCondition(DeletePolicyCondition.ALL);
85 fixture.setRequestID(UUID.randomUUID());
86 fixture.setPdpGroup("");
88 final String result = fixture.getPdpGroup();
90 // add additional test code here
91 assertEquals("", result);
95 * Run the String getPolicyComponent() method test.
99 * @generatedBy CodePro at 6/1/16 1:40 PM
102 public void testGetPolicyComponent_1() throws Exception {
103 final DeletePolicyParameters fixture = new DeletePolicyParameters();
104 fixture.setPolicyComponent("");
105 fixture.setPolicyName("");
106 fixture.setDeleteCondition(DeletePolicyCondition.ALL);
107 fixture.setRequestID(UUID.randomUUID());
108 fixture.setPdpGroup("");
110 final String result = fixture.getPolicyComponent();
112 // add additional test code here
113 assertEquals("", result);
117 * Run the UUID getRequestID() method test.
121 * @generatedBy CodePro at 6/1/16 1:40 PM
124 public void testGetRequestID_1() throws Exception {
125 final UUID requestID = UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d");
127 final DeletePolicyParameters objUnderTest = new DeletePolicyParameters();
128 objUnderTest.setPolicyComponent(POLICY_COMPONENT);
129 objUnderTest.setPolicyName(POLICY_NAME);
130 objUnderTest.setDeleteCondition(DeletePolicyCondition.ALL);
131 objUnderTest.setRequestID(requestID);
132 objUnderTest.setPdpGroup(PDP_GROUP);
133 objUnderTest.setPolicyType(POLICY_TYPE);
135 final UUID result = objUnderTest.getRequestID();
137 // add additional test code here
138 assertNotNull(result);
139 assertEquals("482e90e2-2ad7-4265-9893-4cfe08ef1e3d", result.toString());
140 assertEquals(4, result.version());
141 assertEquals(2, result.variant());
142 assertEquals(-7452528304412746179L, result.getLeastSignificantBits());
143 assertEquals(5201253920715260517L, result.getMostSignificantBits());
147 * Run the void setDeleteCondition(DeletePolicyCondition) method test.
151 * @generatedBy CodePro at 6/1/16 1:40 PM
154 public void testSetDeleteCondition_1() throws Exception {
155 final UUID requestID = UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d");
157 final DeletePolicyParameters objUnderTest = new DeletePolicyParameters();
158 objUnderTest.setPolicyComponent(POLICY_COMPONENT);
159 objUnderTest.setPolicyName(POLICY_NAME);
160 objUnderTest.setDeleteCondition(DeletePolicyCondition.ALL);
161 objUnderTest.setRequestID(requestID);
162 objUnderTest.setPdpGroup(PDP_GROUP);
163 objUnderTest.setPolicyType(POLICY_TYPE);
165 assertEquals(POLICY_COMPONENT, objUnderTest.getPolicyComponent());
166 assertEquals(POLICY_NAME, objUnderTest.getPolicyName());
167 assertEquals(POLICY_TYPE, objUnderTest.getPolicyType());
168 assertEquals(DeletePolicyCondition.ALL, objUnderTest.getDeleteCondition());
169 assertEquals(requestID, objUnderTest.getRequestID());
173 * Perform pre-test initialization.
176 * if the initialization fails for some reason
178 * @generatedBy CodePro at 6/1/16 1:40 PM
181 public void setUp() throws Exception {
182 // add additional set up code here
186 * Perform post-test clean-up.
189 * if the clean-up fails for some reason
191 * @generatedBy CodePro at 6/1/16 1:40 PM
194 public void tearDown() throws Exception {
195 // Add additional tear down code here
202 * the command line arguments
204 * @generatedBy CodePro at 6/1/16 1:40 PM
206 public static void main(final String[] args) {
207 new org.junit.runner.JUnitCore().run(DeletePolicyParametersTest.class);