Unit test Coverage
[appc.git] / appc-adapters / appc-dmaap-adapter / appc-message-adapter-api / src / test / java / org / onap / appc / adapter / message / event / TestEventHeader.java
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : APPC
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
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
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=========================================================
19 */
20 package org.onap.appc.adapter.message.event;
21
22 import static org.junit.Assert.*;
23
24 import org.junit.Before;
25 import org.junit.Test;
26
27 public class TestEventHeader {
28     private EventHeader eventHeader;
29
30     @Before
31     public void setUp() {
32         eventHeader = new EventHeader("2016-03-15T10:59:33.79Z", "1.01", "<ECOMP_EVENT_ID>");
33     }
34
35     @Test
36     public void testEventTime() {
37         assertNotNull(eventHeader.getEventTime());
38         assertNotEquals(eventHeader.getEventTime(), "");
39         assertEquals(eventHeader.getEventTime(), "2016-03-15T10:59:33.79Z");
40     }
41
42     @Test
43     public void testEventApiVer() {
44         assertNotNull(eventHeader.getApiVer());
45         assertNotEquals(eventHeader.getApiVer(), "");
46         assertEquals(eventHeader.getApiVer(), "1.01");
47     }
48
49     @Test
50     public void testEventId() {
51         assertNotNull(eventHeader.getEventId());
52         assertNotEquals(eventHeader.getEventId(), "");
53         assertEquals(eventHeader.getEventId(), "<ECOMP_EVENT_ID>");
54     }
55
56     @Test
57     public void testToString_ReturnNonEmptyString() {
58         assertNotEquals(eventHeader.toString(), "");
59         assertNotEquals(eventHeader.toString(), null);
60     }
61
62     @Test
63     public void testToString_ContainsString() {
64         assertTrue(eventHeader.toString().contains("eventId"));
65     }
66
67 }