2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * ============LICENSE_END=========================================================
19 package org.onap.policy.common.endpoints.features;
21 import static org.junit.jupiter.api.Assertions.assertFalse;
23 import org.junit.jupiter.api.BeforeEach;
24 import org.junit.jupiter.api.Test;
25 import org.junit.jupiter.api.extension.ExtendWith;
26 import org.mockito.Mock;
27 import org.mockito.junit.jupiter.MockitoExtension;
28 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
29 import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
30 import org.slf4j.Logger;
32 @ExtendWith(MockitoExtension.class)
33 class NetLoggerFeatureApiTest {
36 private Logger mockLogger;
39 private EventType mockEventType;
42 private CommInfrastructure mockCommInfrastructure;
44 private NetLoggerFeatureApi featureApi;
48 featureApi = new NetLoggerFeatureApi() {
50 public boolean beforeLog(Logger eventLogger, EventType type, CommInfrastructure protocol, String topic,
52 return NetLoggerFeatureApi.super.beforeLog(eventLogger, type, protocol, topic, message);
56 public boolean afterLog(Logger eventLogger, EventType type, CommInfrastructure protocol, String topic,
58 return NetLoggerFeatureApi.super.afterLog(eventLogger, type, protocol, topic, message);
62 public int getSequenceNumber() {
67 public String getName() {
68 return NetLoggerFeatureApi.super.getName();
74 void testBeforeLogDefaultBehavior() {
75 boolean result = featureApi.beforeLog(mockLogger, mockEventType, mockCommInfrastructure,
76 "testTopic", "testMessage");
77 assertFalse(result, "Expected beforeLog to return false by default");
81 void testAfterLogDefaultBehavior() {
82 boolean result = featureApi.afterLog(mockLogger, mockEventType, mockCommInfrastructure,
83 "testTopic", "testMessage");
84 assertFalse(result, "Expected afterLog to return false by default");