2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Copyright (c) 2017-2019 European Software Marketing Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.aai.babel;
24 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
25 import static org.junit.jupiter.api.Assertions.assertThrows;
26 import static org.junit.jupiter.api.Assertions.assertTrue;
28 import org.junit.jupiter.api.BeforeEach;
29 import org.junit.jupiter.api.Test;
30 import org.springframework.boot.test.context.SpringBootTest;
31 import org.springframework.test.context.ActiveProfiles;
32 import org.springframework.test.context.TestPropertySource;
35 classes = BabelApplication.class,
36 webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
38 @ActiveProfiles("test")
39 @TestPropertySource(properties = {
41 "CONFIG_HOME=src/test/resources"
43 public class TestApplication {
47 System.setProperty("APP_HOME", ".");
48 System.setProperty("CONFIG_HOME", "src/test/resources");
52 public void testApplicationStarts() {
53 assertDoesNotThrow(() -> {
54 BabelApplication.main(new String[] {});
55 BabelApplication.exit();
60 public void testApplicationStartsWithObfuscatedPassword() {
61 assertDoesNotThrow(() -> {
62 BabelApplication.main(new String[] {});
63 BabelApplication.exit();
68 public void testApplicationWithNullArgs() {
69 Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
70 BabelApplication.main(null);
72 assertTrue(exception.getMessage().contains("Args must not be null"));