2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 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.policy.m2.adapters;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertTrue;
26 import org.junit.Test;
28 import org.onap.policy.controlloop.ControlLoopEvent;
29 import org.onap.policy.controlloop.ControlLoopNotification;
30 import org.onap.policy.controlloop.VirtualControlLoopEvent;
31 import org.onap.policy.controlloop.VirtualControlLoopNotification;
32 import org.onap.policy.m2.base.OnsetAdapter;
34 public class VirtualOnsetAdapterTest {
38 VirtualOnsetAdapter.register();
39 VirtualControlLoopEvent virtualControlLoopEvent = new VirtualControlLoopEvent();
40 VirtualOnsetAdapter virtualOnsetAdapter =
41 VirtualOnsetAdapter.class.cast(OnsetAdapter.get(virtualControlLoopEvent));
42 assertTrue(virtualOnsetAdapter != null);
44 ControlLoopNotification notification = virtualOnsetAdapter.createNotification(virtualControlLoopEvent);
45 assertTrue(notification != null);
46 // we want an exact class match, so 'instanceOf' is not being used
47 assertEquals(VirtualControlLoopNotification.class, notification.getClass());
49 ControlLoopEvent controlLoopEvent = new ControlLoopEvent() {};
50 notification = virtualOnsetAdapter.createNotification(controlLoopEvent);
51 assertTrue(notification != null);