001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.classic.util; 015 016import static org.junit.Assert.assertEquals; 017 018import org.junit.Test; 019 020import ch.qos.logback.classic.Level; 021import ch.qos.logback.classic.spi.ILoggingEvent; 022import ch.qos.logback.classic.spi.LoggingEvent; 023import ch.qos.logback.core.net.SyslogConstants; 024 025public class LevelToSyslogSeverityTest { 026 027 @Test 028 public void smoke() { 029 030 assertEquals(SyslogConstants.DEBUG_SEVERITY, LevelToSyslogSeverity.convert(createEventOfLevel(Level.TRACE))); 031 032 assertEquals(SyslogConstants.DEBUG_SEVERITY, LevelToSyslogSeverity.convert(createEventOfLevel(Level.DEBUG))); 033 034 assertEquals(SyslogConstants.INFO_SEVERITY, LevelToSyslogSeverity.convert(createEventOfLevel(Level.INFO))); 035 036 assertEquals(SyslogConstants.WARNING_SEVERITY, LevelToSyslogSeverity.convert(createEventOfLevel(Level.WARN))); 037 038 assertEquals(SyslogConstants.ERROR_SEVERITY, LevelToSyslogSeverity.convert(createEventOfLevel(Level.ERROR))); 039 040 } 041 042 ILoggingEvent createEventOfLevel(Level level) { 043 LoggingEvent event = new LoggingEvent(); 044 event.setLevel(level); 045 return event; 046 } 047 048}