Merge "Read lock promotion"
[music.git] / music-core / src / test / java / org / onap / music / exceptions / MusicPolicyVoilationExceptionTest.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
23 package org.onap.music.exceptions;
24
25 import static org.junit.Assert.assertEquals;
26
27 import org.junit.Test;
28
29 public class MusicPolicyVoilationExceptionTest {
30
31     @Test
32     public void TestException1() {
33         String s1 = "Value1";
34         String s2 = "value2";
35         try {
36             if (!s1.equalsIgnoreCase(s2)) {
37                 throw new MusicPolicyVoilationException();
38             }
39         } catch (MusicPolicyVoilationException mve) {
40             assertEquals("org.onap.music.exceptions.MusicPolicyVoilationException", mve.getClass().getName());
41         }
42
43     }
44
45     @Test
46     public void TestException2() {
47         String s1 = "Value1";
48         String s2 = "value2";
49         try {
50             if (!s1.equalsIgnoreCase(s2)) {
51                 throw new MusicPolicyVoilationException("MusicPolicyVoilationException Exception occured..");
52             }
53         } catch (MusicPolicyVoilationException mve) {
54             assertEquals(mve.getMessage(), "MusicPolicyVoilationException Exception occured..");
55         }
56
57     }
58
59     @Test
60     public void TestException3() {
61         String s1 = "Value1";
62         String s2 = "value2";
63         try {
64             if (!s1.equalsIgnoreCase(s2)) {
65                 throw new MusicPolicyVoilationException(new Throwable());
66             }
67         } catch (MusicPolicyVoilationException mve) {
68             assertEquals("org.onap.music.exceptions.MusicPolicyVoilationException", mve.getClass().getName());
69         }
70
71     }
72
73     @Test
74     public void TestException4() {
75         String message = "Exception occured";
76         String s1 = "Value1";
77         String s2 = "value2";
78         try {
79             if (!s1.equalsIgnoreCase(s2)) {
80                 throw new MusicPolicyVoilationException(message, new Throwable());
81             }
82         } catch (MusicPolicyVoilationException mve) {
83             assertEquals("org.onap.music.exceptions.MusicPolicyVoilationException", mve.getClass().getName());
84         }
85
86     }
87
88     @Test
89     public void TestException5() {
90         String message = "Exception occured";
91         boolean enableSuppression = true;
92         boolean writableStackTrace = false;
93         String s1 = "Value1";
94         String s2 = "value2";
95         try {
96             if (!s1.equalsIgnoreCase(s2)) {
97                 throw new MusicPolicyVoilationException(message, new Throwable(), enableSuppression,
98                         writableStackTrace);
99             }
100         } catch (MusicPolicyVoilationException mve) {
101             assertEquals("org.onap.music.exceptions.MusicPolicyVoilationException", mve.getClass().getName());
102         }
103
104     }
105
106 }