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 MusicQueryExceptionTest {
31 public void TestException1() {
35 if (!s1.equalsIgnoreCase(s2)) {
36 throw new MusicQueryException();
38 } catch (MusicQueryException mqe) {
39 assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
45 public void TestException2() {
49 if (!s1.equalsIgnoreCase(s2)) {
50 throw new MusicQueryException("MusicQueryException Exception occured..");
52 } catch (MusicQueryException mqe) {
53 assertEquals(mqe.getMessage(), "MusicQueryException Exception occured..");
59 public void TestException3() {
63 if (!s1.equalsIgnoreCase(s2)) {
64 throw new MusicQueryException("MusicQueryException Exception occured..", 001);
66 } catch (MusicQueryException mqe) {
67 assertEquals(mqe.getMessage(), "MusicQueryException Exception occured..");
73 public void TestException4() {
77 if (!s1.equalsIgnoreCase(s2)) {
78 throw new MusicQueryException(new Throwable());
80 } catch (MusicQueryException mqe) {
81 assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
87 public void TestException5() {
88 String message = "Exception occured";
92 if (!s1.equalsIgnoreCase(s2)) {
93 throw new MusicQueryException(message, new Throwable());
95 } catch (MusicQueryException mqe) {
96 assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());
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";
109 if (!s1.equalsIgnoreCase(s2)) {
110 throw new MusicQueryException(message, new Throwable(), enableSuppression, writableStackTrace);
112 } catch (MusicQueryException mqe) {
113 assertEquals("org.onap.music.exceptions.MusicQueryException", mqe.getClass().getName());