### Question:
ProfileMetricService extends AbstractScheduledService { @VisibleForTesting void emitMetric() { metricsContext.increment(Constants.Metrics.Program.PROGRAM_NODE_MINUTES, intervalMinutes * numNodes); } ProfileMetricService(MetricsCollectionService metricsCollectionService, ProgramRunId programRunId,
                              ProfileId profileId, int numNodes); @VisibleForTesting  ProfileMetricService(MetricsCollectionService metricsCollectionService, ProgramRunId programRunId,
                       ProfileId profileId, int numNodes, long intervalMinutes);   }### Answer:
@Test public void testProfileMetrics() throws Exception { ProgramRunId runId = NamespaceId.DEFAULT.app("myApp").workflow("myProgram").run(RunIds.generate()); ProfileId profileId = NamespaceId.DEFAULT.profile("myProfile"); MetricsCollectionService collectionService = injector.getInstance(MetricsCollectionService.class); MetricStore metricStore = injector.getInstance(MetricStore.class); ProfileMetricService scheduledService = new ProfileMetricService(collectionService, runId, profileId, 5, 2); scheduledService.emitMetric(); Tasks.waitFor(10L, () -> getMetric(metricStore, runId, profileId, "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES), 10, TimeUnit.SECONDS); scheduledService.emitMetric(); Tasks.waitFor(20L, () -> getMetric(metricStore, runId, profileId, "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES), 10, TimeUnit.SECONDS); scheduledService.emitMetric(); Tasks.waitFor(30L, () -> getMetric(metricStore, runId, profileId, "system." + Constants.Metrics.Program.PROGRAM_NODE_MINUTES), 10, TimeUnit.SECONDS); }