Remove GroupValidationResult
[policy/models.git] / models-provider / src / test / java / org / onap / policy / models / provider / PolicyModelsProviderParametersTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.models.provider;
23
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertTrue;
26
27 import org.junit.Test;
28 import org.onap.policy.common.parameters.ValidationResult;
29
30 /**
31  * Test of {@link PolicyModelsProviderParameters} class.
32  *
33  * @author Liam Fallon (liam.fallon@est.tech)
34  */
35 public class PolicyModelsProviderParametersTest {
36
37     @Test
38     public void testParameters() {
39         PolicyModelsProviderParameters pars = new PolicyModelsProviderParameters();
40         pars.setDatabaseDriver("MichaelsShumacher");
41         pars.setDatabaseUrl("jdbc://www.acmecorp/roadrunner");
42         pars.setPersistenceUnit("WileECoyote");
43
44         ValidationResult result = pars.validate();
45         assertTrue(result.isValid());
46
47         pars.setImplementation(null);
48         result = pars.validate();
49         assertFalse(result.isValid());
50         pars.setImplementation("An Implementation");
51         result = pars.validate();
52         assertTrue(result.isValid());
53
54         pars.setDatabaseUrl(null);
55         result = pars.validate();
56         assertFalse(result.isValid());
57         pars.setDatabaseUrl("jdbc://www.acmecorp/roadrunner");
58         result = pars.validate();
59         assertTrue(result.isValid());
60
61         pars.setPersistenceUnit(null);
62         result = pars.validate();
63         assertFalse(result.isValid());
64         pars.setPersistenceUnit("WileECoyote");
65         result = pars.validate();
66         assertTrue(result.isValid());
67
68         pars.setDatabaseDriver(null);
69         result = pars.validate();
70         assertFalse(result.isValid());
71         pars.setDatabaseDriver("MichaelsShumacher");
72         result = pars.validate();
73         assertTrue(result.isValid());
74     }
75 }