Merge "Some bug fixes and Minor Chages."
[music.git] / src / test / java / org / onap / music / exceptions / MusicQueryExceptionTest.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  * Copyright (c) 2019 IBM Intellectual Property
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  *
19  * ============LICENSE_END=============================================
20  * ====================================================================
21  */
22 package org.onap.music.exceptions;
23
24 import static org.junit.Assert.assertEquals;
25
26 import org.junit.Test;
27
28 public class MusicQueryExceptionTest {
29
30     @Test
31     public void TestException1() {
32         String s1 = "Value1";
33         String s2 = "value2";
34         try {
35             if (!s1.equalsIgnoreCase(s2)) {
36                 throw new MusicQueryException();
37             }
38         } catch (MusicQueryException mqe) {
39             assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
40         }
41
42     }
43
44     @Test
45     public void TestException2() {
46         String s1 = "Value1";
47         String s2 = "value2";
48         try {
49             if (!s1.equalsIgnoreCase(s2)) {
50                 throw new MusicQueryException("MusicQueryException Exception occured..");
51             }
52         } catch (MusicQueryException mqe) {
53             assertEquals(mqe.getMessage(), "MusicQueryException Exception occured..");
54         }
55
56     }
57
58     @Test
59     public void TestException3() {
60         String s1 = "Value1";
61         String s2 = "value2";
62         try {
63             if (!s1.equalsIgnoreCase(s2)) {
64                 throw new MusicQueryException("MusicQueryException Exception occured..", 001);
65             }
66         } catch (MusicQueryException mqe) {
67             assertEquals(mqe.getMessage(), "MusicQueryException Exception occured..");
68         }
69
70     }
71
72     @Test
73     public void TestException4() {
74         String s1 = "Value1";
75         String s2 = "value2";
76         try {
77             if (!s1.equalsIgnoreCase(s2)) {
78                 throw new MusicQueryException(new Throwable());
79             }
80         } catch (MusicQueryException mqe) {
81             assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
82         }
83
84     }
85
86     @Test
87     public void TestException5() {
88         String message = "Exception occured";
89         String s1 = "Value1";
90         String s2 = "value2";
91         try {
92             if (!s1.equalsIgnoreCase(s2)) {
93                 throw new MusicQueryException(message, new Throwable());
94             }
95         } catch (MusicQueryException mqe) {
96             assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
97         }
98
99     }
100
101     @Test
102     public void TestException6() {
103         String message = "Exception occured";
104         boolean enableSuppression = true;
105         boolean writableStackTrace = false;
106         String s1 = "Value1";
107         String s2 = "value2";
108         try {
109             if (!s1.equalsIgnoreCase(s2)) {
110                 throw new MusicQueryException(message, new Throwable(), enableSuppression, writableStackTrace);
111             }
112         } catch (MusicQueryException mqe) {
113             assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
114         }
115
116     }
117
118 }