### Question:
SyslogAppender { static ch.qos.logback.classic.net.SyslogAppender constructAppender(final Map<String, Object> properties) { final String suffixPattern = PropertiesUtil .toString(properties.get(PROP_SUFFIX_PATTERN), DEFAULT_SUFFIX_PATTERN); final int port = PropertiesUtil.toInteger(properties.get(PROP_PORT), DEFAULT_PORT); final String host = PropertiesUtil.toString(properties.get(PROP_HOST), null); final String facility = PropertiesUtil.toString(properties.get(PROP_FACILITY), DEFAULT_FACILITY); final String stackTracePattern = PropertiesUtil.toString(properties.get(PROP_STACK_TRACE_PATTERN), null); final boolean throwableExcluded = PropertiesUtil.toBoolean(properties.get(PROP_THROWABLE_EXCLUDED), DEFAULT_THROWABLE_EXCLUDED); if (StringUtils.isEmpty(host) || port == -1) { throw new IllegalArgumentException( "Syslog Appender not configured correctly. Both host and port need to be provided."); } SyslogAppenderBase.facilityStringToint(facility); final ch.qos.logback.classic.net.SyslogAppender appender = new ch.qos.logback.classic.net.SyslogAppender(); appender.setSyslogHost(host); appender.setPort(port); appender.setFacility(facility); appender.setSuffixPattern(suffixPattern); if (StringUtils.isNotEmpty(stackTracePattern)) { appender.setStackTracePattern(stackTracePattern); } appender.setThrowableExcluded(throwableExcluded); return appender; }    }### Answer:
@Test public void testConstructSyslogAppender() { boolean nullHostThrown = false; try { ch.qos.logback.classic.net.SyslogAppender logAppender = SyslogAppender.constructAppender(createConfig(null, 465, "test", "USER", null, false, "my.logger")); } catch (final IllegalArgumentException e) { nullHostThrown = true; } assertTrue("a null host should throw an IllegalArgumentException", nullHostThrown); boolean emptyHostThrown = false; try { ch.qos.logback.classic.net.SyslogAppender logAppender = SyslogAppender.constructAppender(createConfig("", 465, "test", "USER", null, false, "my.logger")); } catch (final IllegalArgumentException e) { emptyHostThrown = true; } assertTrue("an empty host should throw an IllegalArgumentException", emptyHostThrown); boolean negativePortThrown = false; try { ch.qos.logback.classic.net.SyslogAppender logAppender = SyslogAppender.constructAppender(createConfig("localhost", -1, "test", "USER", null, false, "my.logger")); } catch (final IllegalArgumentException e) { negativePortThrown = true; } assertTrue("a negative port should throw an IllegalArgumentException", negativePortThrown); ch.qos.logback.classic.net.SyslogAppender logAppender = SyslogAppender.constructAppender(createConfig("localhost", 465, "test", "USER", "fff", false, "my.logger")); assertEquals("stack trace pattern should match", "fff", logAppender.getStackTracePattern()); }