### Question:
SMSPingMonitor extends AbstractServiceMonitor { @Override public PollStatus poll(MonitoredService svc, Map<String, Object> parameters) { int retries = ParameterMap.getKeyedInteger(parameters, "retry", PingConstants.DEFAULT_RETRIES); long timeout = ParameterMap.getKeyedLong(parameters, "timeout", PingConstants.DEFAULT_TIMEOUT); Long rtt = null; String phoneNumber = null; try { phoneNumber = phonebook.getTargetForAddress(svc.getIpAddr()); } catch (final PhonebookException e) { LogUtils.warnf(this, e, "Unable to get phonebook target for %s", svc.getIpAddr()); } if (phoneNumber != null) { try { rtt = SmsPinger.ping(phoneNumber, timeout, retries); } catch (final Exception e) { LogUtils.warnf(this, e, "Unable to ping phone number: %s", phoneNumber); } } if (rtt != null) { return PollStatus.available(rtt.doubleValue()); } else { return PollStatus.unavailable(); } }  @Override void initialize(Map<String,Object> params); @Override PollStatus poll(MonitoredService svc, Map<String, Object> parameters);  }### Answer:
@Test @DirtiesContext public void testPing() { assertNotNull(m_smsService); assertEquals("ACM0", m_smsService.getGateways().iterator().next().getGatewayId()); SMSPingMonitor p = new SMSPingMonitor(); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("retry", "0"); parameters.put("timeout", "30000"); PollStatus s = p.poll(m_service, parameters); System.err.println("reason = " + s.getReason()); System.err.println("status name = " + s.getStatusName()); assertEquals("ping should pass", PollStatus.SERVICE_AVAILABLE, s.getStatusCode()); }