Removing AAF references from Cert-Service in OOM repo.
[oom/platform/cert-service.git] / certService / src / test / java / org / onap / oom / certservice / certification / configuration / validation / constraints / Cmpv2UrlValidatorTest.java
1 /*
2  * ============LICENSE_START=======================================================
3  * PROJECT
4  * ================================================================================
5  * Copyright (C) 2020 Nokia. 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
22 package org.onap.oom.certservice.certification.configuration.validation.constraints;
23
24 import org.junit.jupiter.api.Test;
25
26 import static org.junit.jupiter.api.Assertions.assertFalse;
27 import static org.junit.jupiter.api.Assertions.assertTrue;
28
29
30 class Cmpv2UrlValidatorTest {
31
32     private final Cmpv2UrlValidator validator = new Cmpv2UrlValidator();
33
34     @Test
35     void givenCorrectUrlWhenValidatingShouldReturnTrue() {
36         //given
37         String url = "http://127.0.0.1/ejbca/publicweb/cmp/cmp";
38
39         //when
40         boolean result = validator.isValid(url, null);
41
42         //then
43         assertTrue(result);
44     }
45
46     @Test
47     void givenIncorrectUrlWhenValidatingShouldReturnFalse() {
48         //given
49         String url = "httttp://127.0.0.1:80000/ejbca/publicweb/cmp/cmp";
50
51         //when
52         boolean result = validator.isValid(url, null);
53
54         //then
55         assertFalse(result);
56     }
57 }