### Question:
JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " + counter, e); } return 0L; } JobCounterGauge(Job job, String groupName, String counterName);  JobCounterGauge(Job job, Enum<?> counter); private  JobCounterGauge(Job job, Enum<?> counter, String groupName, String counterName); @Override Long getValue();  }### Answer:
@Test public void getValue() { jobCounterGauge = new JobCounterGauge(job, key); Long result = jobCounterGauge.getValue(); assertThat(result, is(expectedResult)); }
@Test public void getValueGroupName() { jobCounterGauge = new JobCounterGauge(job, groupName, counterName); Long result = jobCounterGauge.getValue(); assertThat(result, is(expectedResult)); }
@Test public void getValueCannotGetCounters() throws IOException { when(job.getCounters()).thenThrow(new IOException()); jobCounterGauge = new JobCounterGauge(job, key); Long result = jobCounterGauge.getValue(); assertThat(result, is(0L)); }