### Question:
CoreMetrics { public static void registerCoreMetrics(Version buildInfo, MetricRegistry metrics) { registerVersionMetric(buildInfo, metrics); registerJvmMetrics(metrics); metrics.register("os", new OperatingSystemMetricSet()); } private  CoreMetrics(); static void registerCoreMetrics(Version buildInfo, MetricRegistry metrics);  }### Answer:
@Test public void registersVersionMetric() { MetricRegistry metrics = new CodaHaleMetricRegistry(); CoreMetrics.registerCoreMetrics(version, metrics); Gauge gauge = metrics.getGauges().get("styx.version.buildnumber"); assertThat(gauge.getValue(), is(3)); }
@Test public void registersJvmMetrics() { MetricRegistry metrics = new CodaHaleMetricRegistry(); CoreMetrics.registerCoreMetrics(version, metrics); Map<String, Gauge> gauges = metrics.getGauges(); assertThat(gauges.keySet(), hasItems( "jvm.thread.blocked.count", "jvm.thread.count", "jvm.thread.daemon.count", "jvm.thread.deadlock.count", "jvm.thread.deadlocks", "jvm.thread.new.count", "jvm.thread.runnable.count", "jvm.thread.terminated.count", "jvm.thread.timed_waiting.count", "jvm.thread.waiting.count", "jvm.uptime", "jvm.uptime.formatted" )); }
@Test public void registersOperatingSystemMetrics() { MetricRegistry metrics = new CodaHaleMetricRegistry(); CoreMetrics.registerCoreMetrics(version, metrics); Map<String, Gauge> gauges = metrics.getGauges(); assertThat(gauges.keySet(), hasItems( "os.process.cpu.load", "os.process.cpu.time", "os.system.cpu.load", "os.memory.physical.free", "os.memory.physical.total", "os.memory.virtual.committed", "os.swapSpace.free", "os.swapSpace.total" )); }