### Question:
SnmpMonitorStrategy extends AbstractServiceMonitor { public boolean meetsCriteria(SnmpValue result, String operator, String operand) { Boolean retVal = null; retVal = isCriteriaNull(result, operator, operand); if (retVal == null) { String value = getStringValue(result); retVal = checkStringCriteria(operator, operand, value); if (retVal == null) { BigInteger val = BigInteger.valueOf(result.toLong()); BigInteger intOperand = new BigInteger(operand); if (LESS_THAN.equals(operator)) { return val.compareTo(intOperand) < 0; } else if (LESS_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) <= 0; } else if (GREATER_THAN.equals(operator)) { return val.compareTo(intOperand) > 0; } else if (GREATER_THAN_EQUALS.equals(operator)) { return val.compareTo(intOperand) >= 0; } else { throw new IllegalArgumentException("operator " + operator + " is unknown"); } } } else if (retVal.booleanValue()) { return true; } return retVal.booleanValue(); }  abstract PollStatus poll(MonitoredService svc, Map<String, Object> parameters); String getStringValue(SnmpValue result); boolean meetsCriteria(SnmpValue result, String operator, String operand);  }### Answer:
@Test public void testMeetsCriteriaWithNullResult() { SnmpValue result = null; assertFalse(monitor.meetsCriteria(result, null, null)); }
@Test public void testErrorConditions() { SnmpValue result = int32Value(1); ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new IllegalArgumentException("operator X is unknown")); try { monitor.meetsCriteria(result, "X", "123"); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }
@Test public void testErrorConditions2() { SnmpValue result = int32Value(1); ThrowableAnticipator ta = new ThrowableAnticipator(); ta.anticipate(new NumberFormatException("For input string: \"abc\"")); try { monitor.meetsCriteria(result, "<", "abc"); fail("expected an exception"); } catch (Throwable t) { ta.throwableReceived(t); } ta.verifyAnticipated(); }