### Question:
ThresholdingVisitor extends AbstractCollectionSetVisitor { public boolean hasThresholds() { return m_thresholdingSet.hasThresholds(); } protected  ThresholdingVisitor(CollectorThresholdingSet thresholdingSet); static ThresholdingVisitor create(int nodeId, String hostAddress, String serviceName, RrdRepository repo, ServiceParameters svcParams); boolean hasThresholds(); @Override void visitCollectionSet(CollectionSet set); void reload(); void reloadScheduledOutages(); boolean isNodeInOutage(); @Override void visitResource(CollectionResource resource); @Override void visitAttribute(CollectionAttribute attribute); @Override void completeResource(CollectionResource resource); Date getCollectionTimestamp(); @Override String toString();  }### Answer:
@Test public void testBug3488() throws Exception { String ipAddress = "127.0.0.1"; setupSnmpInterfaceDatabase(ipAddress, null); LatencyThresholdingSet thresholdingSet = new LatencyThresholdingSet(1, ipAddress, "HTTP", getRepository()); assertTrue(thresholdingSet.hasThresholds()); Map<String, Double> attributes = new HashMap<String, Double>(); attributes.put("http", 200.0); assertTrue(thresholdingSet.hasThresholds(attributes)); m_defaultErrorLevelToCheck = Level.ERROR; List<Event> triggerEvents = new ArrayList<Event>(); for (int i=0; i<5; i++) triggerEvents.addAll(thresholdingSet.applyThresholds("http", attributes)); LoggingEvent[] events = MockLogAppender.getEventsGreaterOrEqual(Level.WARN); assertEquals("expecting 5 events", 5, events.length); for (LoggingEvent e : events) assertEquals("Interface (nodeId/ipAddr=1/127.0.0.1) has no ifName and no ifDescr...setting to label to 'no_ifLabel'.", e.getMessage()); assertTrue(triggerEvents.size() == 1); addEvent(EventConstants.HIGH_THRESHOLD_EVENT_UEI, "127.0.0.1", "HTTP", 5, 100.0, 50.0, 200.0, "no_ifLabel", "127.0.0.1[http]", "http", "no_ifLabel", null, m_anticipator, m_anticipatedEvents); ThresholdingEventProxy proxy = new ThresholdingEventProxy(); proxy.add(triggerEvents); proxy.sendAllEvents(); verifyEvents(0); }
@Test public void testBug3575() throws Exception { initFactories("/threshd-configuration-bug3575.xml","/test-thresholds-bug3575.xml"); String ipAddress = "127.0.0.1"; String ifName = "eth0"; setupSnmpInterfaceDatabase(ipAddress, ifName); LatencyThresholdingSet thresholdingSet = new LatencyThresholdingSet(1, ipAddress, "StrafePing", getRepository()); assertTrue(thresholdingSet.hasThresholds()); Map<String, Double> attributes = new HashMap<String, Double>(); for (double i=1; i<21; i++) attributes.put("ping" + i, 2 * i); attributes.put("loss", 60.0); attributes.put("response-time", 100.0); attributes.put("median", 100.0); assertTrue(thresholdingSet.hasThresholds(attributes)); List<Event> triggerEvents = thresholdingSet.applyThresholds("StrafePing", attributes); assertTrue(triggerEvents.size() == 1); addEvent(EventConstants.HIGH_THRESHOLD_EVENT_UEI, "127.0.0.1", "StrafePing", 1, 50.0, 25.0, 60.0, ifName, "127.0.0.1[StrafePing]", "loss", "eth0", null, m_anticipator, m_anticipatedEvents); ThresholdingEventProxy proxy = new ThresholdingEventProxy(); proxy.add(triggerEvents); proxy.sendAllEvents(); verifyEvents(0); }