ConduitMetrics { @SuppressWarnings("rawtypes") public static Gauge registerGauge(String name, Gauge gaugeInst) { if(!isEnabled){ LOG.warn("metrics not enabled"); return null; } if (registry.getGauges().get(name) != null) { LOG.warn("Gauge with name " + name + " already exsits"); return null; } return registry.register(name, gaugeInst); }  static void init(Properties config); static void startAll(); static void stopAll(); static AbsoluteGauge registerAbsoluteGauge(String serviceName,
                                                    String counterType,
                                                    String context); static AbsoluteGauge registerAbsoluteGauge(String name,
      Number initalValue); static void updateAbsoluteGauge(String serviceName,
                                         String counterType,
                                         String context, Number value); @SuppressWarnings("rawtypes") static Gauge registerGauge(String name, Gauge gaugeInst); synchronized static Counter registerCounter(String serviceName,
      String counterType, String context); @SuppressWarnings("unchecked") static T getMetric(String serviceName,
			String counterType, String context); static void incCounter(String serviceName, String counterType,
      String context ,long value); static SlidingTimeWindowGauge registerSlidingWindowGauge(String serviceName,
	      String counterType, String context); static void updateSWGuage(String serviceName, String counterType,
			String context, long value);  }
@SuppressWarnings("unchecked") @Test public void testRegisterGauge() { final String gaugeName = "test.guage"; final List<Integer> l = new ArrayList<Integer>(); Gauge<Integer> gaugeInst = new Gauge<Integer>() { @Override public Integer getValue() { return l.size(); } }; gaugeInst = ConduitMetrics.registerGauge(gaugeName, gaugeInst); Assert.assertNotNull(gaugeInst); Assert.assertEquals(gaugeInst.getValue(), new Integer(0)); l.add(2); Assert.assertEquals(gaugeInst.getValue(), new Integer(1)); gaugeInst = ConduitMetrics.registerGauge(gaugeName, gaugeInst); Assert.assertNull(gaugeInst); }