583a9fd4354aaada44104838227d1f2d31975c84
[music.git] / src / test / java / org / onap / music / exceptions / MusicLockingExceptionTest.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 MusicLockingExceptionTest {
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 MusicLockingException();
37             }
38         } catch (MusicLockingException mle) {
39             assertEquals("org.onap.music.exceptions.MusicLockingException", mle.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 MusicLockingException("MusicLockingException Exception occured..");
51             }
52         } catch (MusicLockingException mle) {
53             assertEquals(mle.getMessage(), "MusicLockingException 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 MusicLockingException(new Throwable());
65             }
66         } catch (MusicLockingException mle) {
67             assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());
68         }
69
70     }
71
72     @Test
73     public void TestException4() {
74         String message = "Exception occured";
75         String s1 = "Value1";
76         String s2 = "value2";
77         try {
78             if (!s1.equalsIgnoreCase(s2)) {
79                 throw new MusicLockingException(message, new Throwable());
80             }
81         } catch (MusicLockingException mle) {
82             assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());
83         }
84
85     }
86
87     @Test
88     public void TestException5() {
89         String message = "Exception occured";
90         boolean enableSuppression = true;
91         boolean writableStackTrace = false;
92         String s1 = "Value1";
93         String s2 = "value2";
94         try {
95             if (!s1.equalsIgnoreCase(s2)) {
96                 throw new MusicLockingException(message, new Throwable(), enableSuppression, writableStackTrace);
97             }
98         } catch (MusicLockingException mle) {
99             assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());
100         }
101
102     }
103
104 }