UimaMonitor { public void entityRemoved(String type) { Long count = entityRemovedCounts.get(type); if (count == null) { count = 0L; } count++; entityRemovedCounts.put(type, count); logger.trace("Entity of type {} removed", type); } UimaMonitor(String pipelineName, Class<?> clazz); String getPipelineName(); void startFunction(String functionName); void finishFunction(String functionName); void startFunctionTrace(String functionName); void finishFunctionTrace(String functionName); void entityAdded(String type); void entityRemoved(String type); void persistCounts(); void trace(String message, Object... args); void debug(String message, Object... args); void info(String message, Object... args); void warn(String message, Object... args); void warn(String message, Throwable e); void error(String message, Object... args); void error(String message, Throwable e); Counter counter(String name); Timer timer(String name); Counter histogram(String name); Meter meter(String name);  }
@Test public void testEntityRemoved() { UimaMonitor monitor = new UimaMonitor(PIPELINE, this.getClass()); monitor.entityRemoved(ENTITY_TYPE_1); monitor.entityRemoved(ENTITY_TYPE_1); monitor.entityRemoved(ENTITY_TYPE_2); monitor.entityRemoved(ENTITY_TYPE_2); monitor.entityRemoved(ENTITY_TYPE_1); monitor.persistCounts(); Metrics m = MetricsFactory.getMetrics(PIPELINE, this.getClass()); assertEquals(3, m.getCounter(ENTITY_TYPE_1 + "-removed").getCount()); assertEquals(2, m.getCounter(ENTITY_TYPE_2 + "-removed").getCount()); }