### Question:
CurrentServer { public static boolean isWorkingOnNamedServerHost(TaskunConfig config, String name) { String expected = config.getNamedServerHostname(name); if (StringUtil.isEmpty(expected)) { return false; } return getHostname().matches(expected); }  static boolean isWorkingOnNamedServerHost(TaskunConfig config, String name); static String getServerName(TaskunConfig config); static String getHostname();  }### Answer:
@Test public void isWorkingOnNamedServerHost_A$SchedulerConfig$String_completelyMatched() throws Exception { String arg0 = "test2"; TaskunConfig config = new TaskunConfig(); config.putNamedServer("test2", InetAddress.getLocalHost() .getCanonicalHostName()); boolean actual = CurrentServer.isWorkingOnNamedServerHost(config, arg0); boolean expected = true; assertEquals(expected, actual); }
@Test public void isWorkingOnNamedServerHost_A$SchedulerConfig$String_prefixMatched() throws Exception { String arg0 = "test2"; TaskunConfig config = new TaskunConfig(); String hostname = InetAddress.getLocalHost().getCanonicalHostName(); config.putNamedServer("test2", hostname.replaceAll("\\..+", ".*")); boolean actual = CurrentServer.isWorkingOnNamedServerHost(config, arg0); boolean expected = true; assertEquals(expected, actual); }
@Test public void isWorkingOnNamedServerHost_A$SchedulerConfig$String_false() throws Exception { String arg0 = "test3"; TaskunConfig config = new TaskunConfig(); boolean actual = CurrentServer.isWorkingOnNamedServerHost(config, arg0); boolean expected = false; assertEquals(expected, actual); }
@Test public void isWorkingOnNamedServerHost_A$TaskunConfig$String() throws Exception { TaskunConfig config = new TaskunConfig(); String name = "aaa"; boolean actual = CurrentServer.isWorkingOnNamedServerHost(config, name); boolean expected = false; assertEquals(expected, actual); }