2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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.vid.controller.open;
23 import org.onap.vid.controller.open.VersionController;
24 import org.testng.annotations.DataProvider;
25 import org.testng.annotations.Test;
27 import static org.hamcrest.CoreMatchers.is;
28 import static org.junit.Assert.assertThat;
31 public class VersionControllerTest {
34 public static Object[][] majorVersionContainer() {
35 return new Object[][]{
36 {"features.properties", "1.0.2000", "features.properties.2000"},
37 {"", "1.0.2000", ".2000"},
38 {"kuku", "1.0.2000", "kuku.2000"},
39 {"/kuku", "1.0.2000", "kuku.2000"},
40 {"1810p.features.properties", "1.0.2000", "1810p.2000"},
41 {"/opt/app/dev.features.properties", "1.0.2000", "dev.2000"},
42 {"foo", "2000", "foo.2000"},
46 final VersionController versionController = new VersionController(null);
48 @Test(dataProvider = "majorVersionContainer")
49 public void testGetDisplayVersion(String majorVersionContainer, String buildNumberContainer, String expected) {
50 assertThat(versionController.getDisplayVersion(majorVersionContainer, buildNumberContainer), is(expected));