### Question:
RangerIpMatcher extends RangerAbstractConditionEvaluator { String extractIp(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.extractIp(" + request+ ")"); } String ip = null; if (request == null) { LOG.debug("isMatched: Unexpected: null request object!"); } else { ip = request.getClientIPAddress(); if (ip == null) { LOG.debug("isMatched: Unexpected: Client ip in request object is null!"); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.extractIp(" + request+ "): " + ip); } return ip; }  @Override void init(); @Override boolean isMatched(final RangerAccessRequest request);  }### Answer:
@Test public void test_extractIp() { RangerIpMatcher matcher = new RangerIpMatcher(); assertNull(matcher.extractIp(null)); RangerAccessRequest request = mock(RangerAccessRequest.class); when(request.getClientIPAddress()).thenReturn(null); assertNull(matcher.extractIp(request)); when(request.getClientIPAddress()).thenReturn("anIp"); assertEquals("anIp", matcher.extractIp(request)); }