2 * ============LICENSE_START==========================================
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
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.
19 * ============LICENSE_END=============================================
20 * ====================================================================
22 package org.onap.music.exceptions;
24 import static org.junit.Assert.assertEquals;
26 import org.junit.Test;
28 public class MusicLockingExceptionTest {
31 public void TestException1() {
35 if (!s1.equalsIgnoreCase(s2)) {
36 throw new MusicLockingException();
38 } catch (MusicLockingException mle) {
39 assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());
45 public void TestException2() {
49 if (!s1.equalsIgnoreCase(s2)) {
50 throw new MusicLockingException("MusicLockingException Exception occured..");
52 } catch (MusicLockingException mle) {
53 assertEquals(mle.getMessage(), "MusicLockingException Exception occured..");
59 public void TestException3() {
63 if (!s1.equalsIgnoreCase(s2)) {
64 throw new MusicLockingException(new Throwable());
66 } catch (MusicLockingException mle) {
67 assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());
73 public void TestException4() {
74 String message = "Exception occured";
78 if (!s1.equalsIgnoreCase(s2)) {
79 throw new MusicLockingException(message, new Throwable());
81 } catch (MusicLockingException mle) {
82 assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());
88 public void TestException5() {
89 String message = "Exception occured";
90 boolean enableSuppression = true;
91 boolean writableStackTrace = false;
95 if (!s1.equalsIgnoreCase(s2)) {
96 throw new MusicLockingException(message, new Throwable(), enableSuppression, writableStackTrace);
98 } catch (MusicLockingException mle) {
99 assertEquals("org.onap.music.exceptions.MusicLockingException", mle.getClass().getName());