2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
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.
18 * ============================LICENSE_END===========================================
21 package org.onap.dcae.apod.analytics.model.domain.cef;
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.onap.dcae.apod.analytics.test.BaseDCAEAnalyticsUnitTest;
27 import java.util.Collections;
28 import java.util.Comparator;
29 import java.util.LinkedList;
30 import java.util.List;
34 * @author Rajiv Singla . Creation Date: 11/10/2016.
36 public class EventSeverityTest extends BaseDCAEAnalyticsUnitTest {
38 private static Comparator<EventSeverity> eventSeverityComparator = new Comparator<EventSeverity>() {
40 public int compare(EventSeverity eventSeverity1, EventSeverity eventSeverity2) {
41 return eventSeverity1.compareTo(eventSeverity2);
46 public void testEventSeverityOrdering() throws Exception {
48 List<EventSeverity> eventSeverities = new LinkedList<>();
49 Collections.addAll(eventSeverities,
51 EventSeverity.WARNING,
54 EventSeverity.CRITICAL);
56 Collections.sort(eventSeverities);
58 List<EventSeverity> expectedEventSeverities = new LinkedList<>();
59 Collections.addAll(expectedEventSeverities,
60 EventSeverity.CRITICAL,
63 EventSeverity.WARNING,
67 Assert.assertTrue("Severity Order must be CRITICAL, MAJOR, MINOR, WARNING, NORMAL",
68 eventSeverities.equals(expectedEventSeverities));