package jp.ehobby.util.syslog;

import static jp.ehobby.util.syslog.SyslogFacility.ALERT;
import static jp.ehobby.util.syslog.SyslogFacility.AUDIT;
import static jp.ehobby.util.syslog.SyslogFacility.CLOCK_DAEMON_1;
import static jp.ehobby.util.syslog.SyslogFacility.CLOCK_DAEMON_2;
import static jp.ehobby.util.syslog.SyslogFacility.FTP;
import static jp.ehobby.util.syslog.SyslogFacility.KERNEL;
import static jp.ehobby.util.syslog.SyslogFacility.LINE_PRINTER;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL0;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL1;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL2;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL3;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL4;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL5;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL6;
import static jp.ehobby.util.syslog.SyslogFacility.LOCAL7;
import static jp.ehobby.util.syslog.SyslogFacility.MAIL;
import static jp.ehobby.util.syslog.SyslogFacility.NET_NEWS;
import static jp.ehobby.util.syslog.SyslogFacility.NTP;
import static jp.ehobby.util.syslog.SyslogFacility.SECURITY_AUTHORIZATION_1;
import static jp.ehobby.util.syslog.SyslogFacility.SECURITY_AUTHORIZATION_2;
import static jp.ehobby.util.syslog.SyslogFacility.SYSLOGD;
import static jp.ehobby.util.syslog.SyslogFacility.SYSTEM_DAEMONS;
import static jp.ehobby.util.syslog.SyslogFacility.USER_LEVEL;
import static jp.ehobby.util.syslog.SyslogFacility.UUCP;
import static org.junit.Assert.assertEquals;

import org.junit.Test;


/**
 * SyslogFacility 単体テスト.
 */
@SuppressWarnings("static-method")
public class SyslogFacilityTest {

	/** テスト用 Facility リスト.	*/
	private static final SyslogFacility FACILITY_LIST[] = {
		KERNEL,
		USER_LEVEL,
		MAIL,
		SYSTEM_DAEMONS,
		SECURITY_AUTHORIZATION_1,
		SYSLOGD,
		LINE_PRINTER,
		NET_NEWS,
		UUCP,
		CLOCK_DAEMON_1,
		SECURITY_AUTHORIZATION_2,
		FTP,
		NTP,
		AUDIT,
		ALERT,
		CLOCK_DAEMON_2,
		LOCAL0,
		LOCAL1,
		LOCAL2,
		LOCAL3,
		LOCAL4,
		LOCAL5,
		LOCAL6,
		LOCAL7
	};


	/**
	 * 値取得確認.
	 *
	 * @method getValue()
	 * @process getValue にて値を取得する.
	 * @spec    それぞれの Facility 応じた値が取得されること.
	 */
	@Test
	public void testGetValue() {
		for (int i = 0; i < FACILITY_LIST.length; i++) {
			int val = FACILITY_LIST[i].getValue();
			assertEquals(i, val);
		}
	}


	/**
	 * 優先度取得.
	 *
	 * @method getPriorityValue()
	 * @process getPriorityValue にて値を取得する.
	 * @spec    それぞれの Facility の値 * 8 の値が取得されること.
	 */
	@Test
	public void testGetPriorityValue() {
		for (int i = 0; i < FACILITY_LIST.length; i++) {
			int val = FACILITY_LIST[i].getPriorityValue();
			assertEquals((i * 8), val);
		}
	}


}
