2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.logging.bridge.internal;
10 import org.junit.Test;
11 import org.osgi.framework.Bundle;
12 import org.osgi.framework.ServiceReference;
13 import org.osgi.service.log.LogEntry;
14 import org.osgi.service.log.LogService;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 import static org.mockito.Mockito.doReturn;
19 import static org.mockito.Mockito.mock;
21 public class LogListenerImplTest {
22 private static final Logger logger = LoggerFactory.getLogger(LogListenerImplTest.class);
26 LogListenerImpl tested = new LogListenerImpl(logger);
27 tested.logged(getEntry("m1", null));
28 tested.logged(getEntry("m2", new RuntimeException()));
31 private LogEntry getEntry(final String message, final Exception e) {
32 return new LogEntry() {
34 public Bundle getBundle() {
35 Bundle mock = mock(Bundle.class);
36 doReturn(null).when(mock).getSymbolicName();
41 public ServiceReference getServiceReference() {
46 public int getLevel() {
47 return LogService.LOG_INFO;
51 public String getMessage() {
56 public Throwable getException() {
61 public long getTime() {