2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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=========================================================
20 package org.onap.appc.adapter.message.event;
22 import static org.junit.Assert.*;
24 import org.junit.Before;
25 import org.junit.Test;
27 public class TestEventHeader {
28 private EventHeader eventHeader;
32 eventHeader = new EventHeader("2016-03-15T10:59:33.79Z", "1.01", "<ECOMP_EVENT_ID>");
36 public void testEventTime() {
37 assertNotNull(eventHeader.getEventTime());
38 assertNotEquals(eventHeader.getEventTime(), "");
39 assertEquals(eventHeader.getEventTime(), "2016-03-15T10:59:33.79Z");
43 public void testEventApiVer() {
44 assertNotNull(eventHeader.getApiVer());
45 assertNotEquals(eventHeader.getApiVer(), "");
46 assertEquals(eventHeader.getApiVer(), "1.01");
50 public void testEventId() {
51 assertNotNull(eventHeader.getEventId());
52 assertNotEquals(eventHeader.getEventId(), "");
53 assertEquals(eventHeader.getEventId(), "<ECOMP_EVENT_ID>");
57 public void testToString_ReturnNonEmptyString() {
58 assertNotEquals(eventHeader.toString(), "");
59 assertNotEquals(eventHeader.toString(), null);
63 public void testToString_ContainsString() {
64 assertTrue(eventHeader.toString().contains("eventId"));