### Question:
SNMUtils { static String getMacAddr(String mac) { log.warn("searching mac in string '{}'", mac); if (mac == null) { return ""; } Pattern p = Pattern.compile("(?:[0-9a-fA-F]:?){12}"); Matcher m = p.matcher(mac); if (m.find()) { return m.group(); } else { return ""; } } private  SNMUtils(); static String[] prepareCmd(String cmd, Host host, Map<String, String> additionalProps, Map<String, String> secretProps); static String getMacAddrHost(String host);  }### Answer:
@Test public void testGetMacAddr() { assertEquals("11:22:33:aa:bb:cc", SNMUtils.getMacAddr("xxx (192.168.178.1) at 11:22:33:aa:bb:cc [ether] on eth0")); assertEquals("11:22:33:aa:bb:cc", SNMUtils.getMacAddr("xxx (192.168.178.1) at 11:22:33:aa:bb:cc [ether] on eth0 aa:bb:cc:11:22:33")); assertEquals("", SNMUtils.getMacAddr("xxx (192.168.178.1) at [ether] on eth0")); assertEquals("", SNMUtils.getMacAddr("")); assertEquals("", SNMUtils.getMacAddr(null)); }