Merge "JUnit test for policy/engine PolicyEngineAPI"
[policy/engine.git] / PolicyEngineAPI / src / test / java / org / onap / policy / test / DeletePolicyParametersTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.policy.test;
22
23 import java.util.UUID;
24
25 import org.junit.*;
26 import org.onap.policy.api.DeletePolicyCondition;
27 import org.onap.policy.api.DeletePolicyParameters;
28
29 import static org.junit.Assert.*;
30
31 /**
32  * The class <code>DeletePolicyParametersTest</code> contains tests for the
33  * class <code>{@link DeletePolicyParameters}</code>.
34  *
35  * @generatedBy CodePro at 6/1/16 1:40 PM
36  * @version $Revision: 1.0 $
37  */
38 public class DeletePolicyParametersTest {
39     private static final String POLICY_TYPE = "POLICYTYPE";
40
41     private static final String PDP_GROUP = "PDPGROUP";
42
43     private static final String POLICY_NAME = "Apex";
44
45     private static final String POLICY_COMPONENT = "ApexComponent";
46
47     /**
48      * Run the DeletePolicyCondition getDeleteCondition() method test.
49      *
50      * @throws Exception
51      *
52      * @generatedBy CodePro at 6/1/16 1:40 PM
53      */
54     @Test
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("");
62
63         final DeletePolicyCondition result = fixture.getDeleteCondition();
64
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());
70     }
71
72     /**
73      * Run the String getPdpGroup() method test.
74      *
75      * @throws Exception
76      *
77      * @generatedBy CodePro at 6/1/16 1:40 PM
78      */
79     @Test
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("");
87
88         final String result = fixture.getPdpGroup();
89
90         // add additional test code here
91         assertEquals("", result);
92     }
93
94     /**
95      * Run the String getPolicyComponent() method test.
96      *
97      * @throws Exception
98      *
99      * @generatedBy CodePro at 6/1/16 1:40 PM
100      */
101     @Test
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("");
109
110         final String result = fixture.getPolicyComponent();
111
112         // add additional test code here
113         assertEquals("", result);
114     }
115
116     /**
117      * Run the UUID getRequestID() method test.
118      *
119      * @throws Exception
120      *
121      * @generatedBy CodePro at 6/1/16 1:40 PM
122      */
123     @Test
124     public void testGetRequestID_1() throws Exception {
125         final UUID requestID = UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d");
126
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);
134
135         final UUID result = objUnderTest.getRequestID();
136
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());
144     }
145
146     /**
147      * Run the void setDeleteCondition(DeletePolicyCondition) method test.
148      *
149      * @throws Exception
150      *
151      * @generatedBy CodePro at 6/1/16 1:40 PM
152      */
153     @Test
154     public void testSetDeleteCondition_1() throws Exception {
155         final UUID requestID = UUID.fromString("482e90e2-2ad7-4265-9893-4cfe08ef1e3d");
156
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);
164
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());
170     }
171
172     /**
173      * Perform pre-test initialization.
174      *
175      * @throws Exception
176      *             if the initialization fails for some reason
177      *
178      * @generatedBy CodePro at 6/1/16 1:40 PM
179      */
180     @Before
181     public void setUp() throws Exception {
182         // add additional set up code here
183     }
184
185     /**
186      * Perform post-test clean-up.
187      *
188      * @throws Exception
189      *             if the clean-up fails for some reason
190      *
191      * @generatedBy CodePro at 6/1/16 1:40 PM
192      */
193     @After
194     public void tearDown() throws Exception {
195         // Add additional tear down code here
196     }
197
198     /**
199      * Launch the test.
200      *
201      * @param args
202      *            the command line arguments
203      *
204      * @generatedBy CodePro at 6/1/16 1:40 PM
205      */
206     public static void main(final String[] args) {
207         new org.junit.runner.JUnitCore().run(DeletePolicyParametersTest.class);
208     }
209 }